- edited description
- changed title to IntegerLiteral generates bad bytecode when constructed by the IntegerLiteral constructors
IntegerLiteral generates bad bytecode when constructed by the IntegerLiteral constructors
Issue #218
resolved
ExtendJ 8.0.1 Java SE 8
When creating a nta with a new IntegerLiteral correct code is not generated.
In PQLCreateBCode.jrag:
aspect PQLCreateBCode {
public void QueryQuantExpr.createBCode(CodeGeneration gen) {
toStream().createBCode(gen);
}
}
In PQL.jrag:
aspect PQL {
syn nta Expr QueryQuantExpr.toStream() = new IntegerLiteral(5);
}
In program:
public class PQL {
public static void main(String[] args) {
int c = query(Set.contains(x)):x;
System.out.println("Integer: " + c);
}
}
Expected result: Should print 5.
Actual result: Prints 0.
Comments (5)
-
-
The IntegerLiteral constructors should work as you would expect them to, so this is an obvious error that should be fixed ASAP.
A workaround for this issue is to use
Literal.buildIntegerLiteral(int)
to construct an IntegerLiteral. -
This also affects other numeric literal types.
-
Added test for this issue:
api/intlit_01p
-
- changed status to resolved
Rewrite Java 7 numeric literal handling
- Changed NumericLiteral from an AST type into an interface that IntegerLiteral and LongLiteral implement.
- Removed the rewrite that transformed NumericLiteral into the different kinds of numeric literals.
- Factored out the unary minus rewrites to separate aspect in the Java 4 module to avoid code duplication.
- Fixed error causing numeric literal constructors to not fully initialize the constructed nodes.
fixes
#218(bitbucket)→ <<cset 4bc40f3f336e>>
- Log in to comment