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
Copy file name to clipboardExpand all lines: truffle/src/com.oracle.truffle.api.bytecode.test/src/com/oracle/truffle/api/bytecode/test/basic_interpreter/BasicInterpreterTest.java
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3196,6 +3196,26 @@ public void testTags() {
3196
3196
assertEquals(3L, root.call());
3197
3197
}
3198
3198
3199
+
@Test
3200
+
publicvoidtestPrepareForCall() {
3201
+
assertThrows(IllegalStateException.class, () -> parse("getCallTargetDuringParse", b -> {
3202
+
b.beginRoot();
3203
+
b.beginReturn();
3204
+
b.emitLoadConstant(42L);
3205
+
b.endReturn();
3206
+
BasicInterpreterroot = b.endRoot();
3207
+
root.getCallTarget();
3208
+
}));
3209
+
3210
+
assertTrue(parse("getCallTargetAfterParse", b -> {
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
@ExpectError("This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. Since it is overridden, the definition is unreachable and can be removed.")
364
+
privatestaticfinalStringERROR_MESSAGE = "This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. " +
365
+
"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.";
366
+
367
+
@ExpectError(ERROR_MESSAGE)
365
368
@Override
366
369
publicfinalObjectexecute(VirtualFrameframe) {
367
370
returnnull;
368
371
}
369
372
370
-
@ExpectError("This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. Since it is overridden, the definition is unreachable and can be removed.")
@ExpectError("This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. Since it is overridden, the definition is unreachable and can be removed.")
@ExpectError("This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. Since it is overridden, the definition is unreachable and can be removed.")
@ExpectError("This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. Since it is overridden, the definition is unreachable and can be removed.")
@ExpectError("This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. Since it is overridden, the definition is unreachable and can be removed.")
438
+
@ExpectError(ERROR_MESSAGE)
390
439
publicfinalBytecodeNodegetBytecodeNode() {
391
440
returnnull;
392
441
}
393
442
394
-
@ExpectError("This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. Since it is overridden, the definition is unreachable and can be removed.")
443
+
@ExpectError(ERROR_MESSAGE)
395
444
publicfinalBytecodeRootNodes<?> getRootNodes() {
396
445
returnnull;
397
446
}
@@ -417,11 +466,13 @@ static int add(int x, int y) {
417
466
}
418
467
}
419
468
469
+
@ExpectWarning("This method is overridden by the generated Bytecode DSL class, so this definition is unreachable and can be removed.")
Copy file name to clipboardExpand all lines: truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/bytecode/generator/BytecodeRootNodeElement.java
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -385,6 +385,7 @@ final class BytecodeRootNodeElement extends CodeTypeElement {
emitThrowIllegalStateException(ex, b, "A call target cannot be created until bytecode parsing completes. Request a call target after the parse is complete instead.");
Copy file name to clipboardExpand all lines: truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/bytecode/parser/BytecodeDSLParser.java
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -376,15 +376,23 @@ private void parseBytecodeDSLModel(TypeElement typeElement, BytecodeDSLModel mod
@@ -394,7 +402,8 @@ private void parseBytecodeDSLModel(TypeElement typeElement, BytecodeDSLModel mod
394
402
395
403
if (declared.getModifiers().contains(Modifier.FINAL)) {
396
404
model.addError(declared,
397
-
"This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. Since it is overridden, the definition is unreachable and can be removed.");
405
+
"This method is overridden by the generated Bytecode DSL class, so it cannot be declared final. " +
406
+
"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.");
398
407
} else {
399
408
model.addWarning(declared, "This method is overridden by the generated Bytecode DSL class, so this definition is unreachable and can be removed.");
0 commit comments