< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java

Print this page
*** 613,11 ***
  
          return null;
      }
  
      MethodSymbol findConstructor(ClassSymbol tsym, List<Type> paramTypes, boolean strict) {
!         for (Symbol sym : tsym.members().getSymbolsByName(names.init)) {
              if (sym.kind == MTH) {
                  if (hasParameterTypes((MethodSymbol) sym, paramTypes, strict)) {
                      return (MethodSymbol) sym;
                  }
              }
--- 613,12 ---
  
          return null;
      }
  
      MethodSymbol findConstructor(ClassSymbol tsym, List<Type> paramTypes, boolean strict) {
!         Name constructorName = tsym.isConcreteValueClass() ? names.vnew : names.init;
+         for (Symbol sym : tsym.members().getSymbolsByName(constructorName)) {
              if (sym.kind == MTH) {
                  if (hasParameterTypes((MethodSymbol) sym, paramTypes, strict)) {
                      return (MethodSymbol) sym;
                  }
              }

*** 633,11 ***
                                         List<Type> paramTypes, boolean strict,
                                         Set<ClassSymbol> searched) {
          //### Note that this search is not necessarily what the compiler would do!
  
          // do not match constructors
!         if (methodName == names.init)
              return null;
  
          if (searched.contains(tsym))
              return null;
          searched.add(tsym);
--- 634,11 ---
                                         List<Type> paramTypes, boolean strict,
                                         Set<ClassSymbol> searched) {
          //### Note that this search is not necessarily what the compiler would do!
  
          // do not match constructors
!         if (names.isInitOrVNew(methodName))
              return null;
  
          if (searched.contains(tsym))
              return null;
          searched.add(tsym);

*** 1149,11 ***
          }
          if (errorType instanceof com.sun.tools.javac.code.Type.ClassType classType &&
              errorType.getKind() == TypeKind.ERROR) {
              return extraType2OriginalMap.computeIfAbsent(classType, tt ->
                      new ClassType(classType.getEnclosingType(), classType.typarams_field,
!                             classType.tsym, classType.getMetadata()) {
                          @Override
                          public Type baseType() { return classType; }
                          @Override
                          public TypeKind getKind() {
                              return TypeKind.DECLARED;
--- 1150,11 ---
          }
          if (errorType instanceof com.sun.tools.javac.code.Type.ClassType classType &&
              errorType.getKind() == TypeKind.ERROR) {
              return extraType2OriginalMap.computeIfAbsent(classType, tt ->
                      new ClassType(classType.getEnclosingType(), classType.typarams_field,
!                                   classType.tsym, classType.getMetadata(), classType.getFlavor()) {
                          @Override
                          public Type baseType() { return classType; }
                          @Override
                          public TypeKind getKind() {
                              return TypeKind.DECLARED;
< prev index next >