Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[javac] fresh new batch of binding fixes #392

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,22 @@ IMethodBinding resolveMethod(MethodDeclaration method) {
return null;
}

@Override
IMethodBinding resolveConstructor(SuperConstructorInvocation expression) {
resolve();
JCTree javacElement = this.converter.domToJavac.get(expression);
if (javacElement instanceof JCMethodInvocation javacMethodInvocation) {
javacElement = javacMethodInvocation.getMethodSelect();
}
if (javacElement instanceof JCIdent ident && ident.sym instanceof MethodSymbol methodSymbol) {
return canonicalize(new JavacMethodBinding(ident.type.asMethodType(), methodSymbol, this));
}
if (javacElement instanceof JCFieldAccess fieldAccess && fieldAccess.sym instanceof MethodSymbol methodSymbol) {
return canonicalize(new JavacMethodBinding(fieldAccess.type.asMethodType(), methodSymbol, this));
}
return null;
}

@Override
IBinding resolveName(Name name) {
resolve();
Expand Down Expand Up @@ -470,7 +486,7 @@ ITypeBinding resolveWellKnownType(String typeName) {
com.sun.tools.javac.code.Symtab symtab = com.sun.tools.javac.code.Symtab.instance(this.context);
com.sun.tools.javac.code.Type type = switch (typeName) {
case "byte", "java.lang.Byte" -> symtab.byteType;
case "char", "java.lang.Char" -> symtab.charType;
case "char", "java.lang.Character" -> symtab.charType;
case "double", "java.lang.Double" -> symtab.doubleType;
case "float", "java.lang.Float" -> symtab.floatType;
case "int", "java.lang.Integer" -> symtab.intType;
Expand All @@ -487,7 +503,7 @@ ITypeBinding resolveWellKnownType(String typeName) {
case "java.lang.Error" -> symtab.errorType;
case "java.lang.Class" -> symtab.classType;
case "java.lang.Cloneable" -> symtab.cloneableType;
case "java.lang.Serializable" -> symtab.serializableType;
case "java.io.Serializable" -> symtab.serializableType;
default -> null;
};
if (type == null) {
Expand Down
Loading