You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: Bytecode DSL parser should detect bad root node overrides in parent classes; code generation should not delegate to super method if they are abstract.
Copy file name to clipboardExpand all lines: truffle/src/com.oracle.truffle.api.bytecode.test/src/com/oracle/truffle/api/bytecode/test/error_tests/ErrorTests.java
" You can remove the final modifier to resolve this issue, but since the override will make this method unreachable, it is recommended to simply remove it.";
373
373
@@ -389,7 +389,7 @@ public final int findBytecodeIndex(Node node, Frame frame) {
@@ -459,6 +459,11 @@ public final BytecodeRootNodes<?> getRootNodes() {
459
459
* methods. The generated code should respect the wider visibility (otherwise, a compiler error
460
460
* will occur).
461
461
*/
462
+
@ExpectWarning({
463
+
"Method isInstrumentable() in supertype com.oracle.truffle.api.bytecode.test.error_tests.ErrorTests.RootNodeWithOverrides is overridden by the generated Bytecode DSL class." +
464
+
" You can suppress this warning by re-declaring the method as abstract in this class.",
465
+
"Method prepareForInstrumentation(Set<Class<?>>) in supertype com.oracle.truffle.api.bytecode.test.error_tests.ErrorTests.RootNodeWithMoreOverrides is overridden by the generated Bytecode DSL class." +
466
+
" You can suppress this warning by re-declaring the method as abstract in this class."})
@ExpectWarning("This method is overridden by the generated Bytecode DSL class, so this definition is unreachable and can be removed.")
487
+
@ExpectWarning("This method is overridden by the generated Bytecode DSL class. It is unreachable and can be removed. Bytecode DSL interpreters should use GenerateBytecode#captureFramesForTrace instead.")
"Method findInstrumentableCallNode(Node, Frame, int) in supertype com.oracle.truffle.api.bytecode.test.error_tests.ErrorTests.RootNodeWithFinalOverrides is overridden by the generated Bytecode DSL class." +
563
+
" It cannot be declared final.",
564
+
"Method prepareForInstrumentation(Set<Class<?>>) in supertype com.oracle.truffle.api.bytecode.test.error_tests.ErrorTests.RootNodeWithFinalOverrides is overridden by the generated Bytecode DSL class." +
565
+
" It cannot be declared final.",
566
+
"Method isCaptureFramesForTrace(boolean) in supertype com.oracle.truffle.api.bytecode.test.error_tests.ErrorTests.RootNodeWithFinalOverrides is overridden by the generated Bytecode DSL class." +
567
+
" It cannot be declared final. Bytecode DSL interpreters should use GenerateBytecode#captureFramesForTrace instead."
Copy file name to clipboardExpand all lines: truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/bytecode/generator/BytecodeRootNodeElement.java
Copy file name to clipboardExpand all lines: truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/bytecode/parser/BytecodeDSLParser.java
+87-47Lines changed: 87 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -387,53 +387,7 @@ private void parseBytecodeDSLModel(TypeElement typeElement, BytecodeDSLModel mod
if (declared.getModifiers().contains(Modifier.FINAL)) {
415
-
model.addError(declared,
416
-
"This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. " +
417
-
"You can remove the final modifier to resolve this issue, but since the override will make this method unreachable, it is recommended to simply remove it.");
418
-
} else {
419
-
model.addWarning(declared, "This method is overridden by the generated Bytecode DSL class, so this definition is unreachable and can be removed.");
StringcaptureFramesForTraceMessage = String.format("Bytecode DSL interpreters should use %s#captureFramesForTrace instead.", getSimpleName(types.GenerateBytecode));
message += " You can remove the final modifier to resolve this issue, but since the override will make this method unreachable, it is recommended to simply remove it.";
0 commit comments