< prev index next >

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

Print this page
*** 599,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;
                  }
              }
--- 599,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;
                  }
              }

*** 619,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);
--- 620,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);

*** 1135,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;
--- 1136,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 >