Closed cal101 closed 8 years ago
Cal, I have created a local test with your code and I can't reproduce the error. I am deploying a new version to maven (2.2.9) to ensure that you are executing the changes made on Friday
Here a complete test case:
package de.walkmod.typedclassliteral;
public class ClassLiteral {
<T> T doClass(String x, Class<T> clazz) {
return null;
}
public void x() {
doClass("x", null);
}
}
with my code gives
Caused by: org.walkmod.javalang.exceptions.NoSuchExpressionTypeException: java.lang.IllegalArgumentException: symboldata is null for pos 1 in args ["x", null], expression null
... 35 more
Caused by: java.lang.IllegalArgumentException: symboldata is null for pos 1 in args ["x", null], expression null
at org.walkmod.javalang.compiler.reflection.AbstractGenericsBuilderFromParameterTypes.loadTypeMappingFromTypeArgs(AbstractGenericsBuilderFromParameterTypes.java:164)
at org.walkmod.javalang.compiler.reflection.AbstractGenericsBuilderFromParameterTypes.loadTypeMappingFromTypeArgs(AbstractGenericsBuilderFromParameterTypes.java:131)
at org.walkmod.javalang.compiler.reflection.AbstractGenericsBuilderFromParameterTypes.buildTypeParamsTypes(AbstractGenericsBuilderFromParameterTypes.java:192)
at org.walkmod.javalang.compiler.reflection.GenericsBuilderFromMethodParameterTypes.build(GenericsBuilderFromMethodParameterTypes.java:69)
at org.walkmod.javalang.compiler.types.TypeVisitorAdapter.visit(TypeVisitorAdapter.java:475)
... 34 more
with your code gives:
Caused by: org.walkmod.javalang.exceptions.NoSuchExpressionTypeException: java.lang.NullPointerException
... 35 more
Caused by: java.lang.NullPointerException
at org.walkmod.javalang.compiler.reflection.AbstractGenericsBuilderFromParameterTypes.loadTypeMappingFromTypeArgs(AbstractGenericsBuilderFromParameterTypes.java:160)
at org.walkmod.javalang.compiler.reflection.AbstractGenericsBuilderFromParameterTypes.loadTypeMappingFromTypeArgs(AbstractGenericsBuilderFromParameterTypes.java:131)
at org.walkmod.javalang.compiler.reflection.AbstractGenericsBuilderFromParameterTypes.buildTypeParamsTypes(AbstractGenericsBuilderFromParameterTypes.java:186)
at org.walkmod.javalang.compiler.reflection.GenericsBuilderFromMethodParameterTypes.build(GenericsBuilderFromMethodParameterTypes.java:69)
at org.walkmod.javalang.compiler.types.TypeVisitorAdapter.visit(TypeVisitorAdapter.java:473)
... 34 more
public void loadTypeMappingFromTypeArgs(SymbolTable symbolTable) throws Exception {
...
if (e == null) {
throw new IllegalArgumentException("expression is null for pos " + pos + " in args " + args);
}
if (e.getSymbolData() == null) {
throw new IllegalArgumentException("symboldata is null for pos " + pos + " in args " + args + ", expression " + e);
}
List<SymbolData> params = e.getSymbolData().getParameterizedTypes();
Cal,
Sorry if I have a obvious question, but have you tried this upgrading the javalang-compiler with the last changes? Now it should be 2.2.9
I did but just to be sure I repeated:
rm -rf ~/.ivy2
...
found org.walkmod#javalang-compiler;2.2.9 in maven2
Caused by: java.lang.NullPointerException
at org.walkmod.javalang.compiler.reflection.AbstractGenericsBuilderFromParameterTypes.loadTypeMappingFromTypeArgs(AbstractGenericsBuilderFromParameterTypes.java:160)
results in
Exception is because of extra exception I added (https://github.com/cal101/javalang-compiler/commit/ae21e10aa51b72cc6c4361b069aa68fcb3a0e8b8).