-
Notifications
You must be signed in to change notification settings - Fork 193
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
Static type checking errors on maven compile. #344
Comments
The code snippet below from I'm not sure why this passes for Groovyc and Groovy Console. If I could find where flow-typing for the instanceof check is implemented, I may be able to understand the difference. The variable expression for the field (the true expression) did not have an inferred type set in its metadata, so the field type was used directly. If that type metadata was set, it would be used. public void visitTernaryExpression(final TernaryExpression expression) {
Map<VariableExpression, List<ClassNode>> oldTracker = pushAssignmentTracking();
// create a new temporary element in the if-then-else type info
typeCheckingContext.pushTemporaryTypeInfo();
expression.getBooleanExpression().visit(this);
Expression trueExpression = expression.getTrueExpression();
Expression falseExpression = expression.getFalseExpression();
trueExpression.visit(this);
// pop if-then-else temporary type info
typeCheckingContext.popTemporaryTypeInfo();
falseExpression.visit(this);
ClassNode resultType;
if (isNullConstant(trueExpression) || isNullConstant(falseExpression)) {
BinaryExpression enclosingBinaryExpression = typeCheckingContext.getEnclosingBinaryExpression();
if (enclosingBinaryExpression != null && enclosingBinaryExpression.getRightExpression()==expression) {
resultType = getType(enclosingBinaryExpression.getLeftExpression());
} else if (isNullConstant(trueExpression) && isNullConstant(falseExpression)) {
resultType = OBJECT_TYPE;
} else if (isNullConstant(trueExpression)) {
resultType = wrapTypeIfNecessary(getType(falseExpression));
} else {
resultType = wrapTypeIfNecessary(getType(trueExpression));
}
} else {
// store type information
final ClassNode typeOfTrue = getType(trueExpression);
final ClassNode typeOfFalse = getType(falseExpression);
resultType = lowestUpperBound(typeOfTrue, typeOfFalse);
}
storeType(expression, resultType);
popAssignmentTracking(oldTracker);
} |
This should be fixed in the deployed plug-ins. It will take me some time to create and publish a new batch compiler artifact. FYI, I posted an issue to Groovy for the |
I can't seem to find the newer artifacts on the maven repository. Do I have to use bintray? |
The latest batch compiler and compiler adapter versions are on bintray only at the moment. They will be published to Maven Central once 2.9.2 is released.
|
I use it as a maven plugin to use Groovy with Java, like:
Is there a release calendar I can follow? Also, thank you very much for your help. Really appreciate it. |
Will it be available on Maven? |
It will. I'm not sure of the timetable for completing the necessary setup.
|
Hello.
I have a java 7 project that I want to use Groovy in.
I am migrating some classes that I believe should compile but I get errors.
Here is an example:
The text was updated successfully, but these errors were encountered: