diff options
-rw-r--r-- | jack-tests/tests/com/android/jack/frontend/FrontEndTests.java | 1 | ||||
-rw-r--r-- | jack/src/com/android/jack/ir/impl/JackIrBuilder.java | 23 |
2 files changed, 21 insertions, 3 deletions
diff --git a/jack-tests/tests/com/android/jack/frontend/FrontEndTests.java b/jack-tests/tests/com/android/jack/frontend/FrontEndTests.java index c847dae..7402594 100644 --- a/jack-tests/tests/com/android/jack/frontend/FrontEndTests.java +++ b/jack-tests/tests/com/android/jack/frontend/FrontEndTests.java @@ -305,7 +305,6 @@ public class FrontEndTests { * Test that Jack is neither failing nor dropping the error in this case. */ @Test - @Category(KnownBugs.class) public void testUnusedLocalVar001() throws Exception { File outDir = AbstractTestTools.createTempDir(); diff --git a/jack/src/com/android/jack/ir/impl/JackIrBuilder.java b/jack/src/com/android/jack/ir/impl/JackIrBuilder.java index ee63d9d..72ec551 100644 --- a/jack/src/com/android/jack/ir/impl/JackIrBuilder.java +++ b/jack/src/com/android/jack/ir/impl/JackIrBuilder.java @@ -1862,8 +1862,17 @@ public class JackIrBuilder { explicitConstructor.qualification, allocated); throw new FrontendCompilationError(); + } else if (explicitConstructor.qualification != null && isNested(allocated)) { + ReferenceBinding targetType; + if (allocated.isAnonymousType()) { + targetType = (ReferenceBinding) allocated.superclass().erasure(); + } else { + targetType = allocated; + } + scope.problemReporter().unnecessaryEnclosingInstanceSpecification( + explicitConstructor.qualification, targetType); + throw new FrontendCompilationError(); } - // STOPSHIP Check other cases and report error to the user scope.methodScope().isConstructorCall = true; return true; @@ -2033,7 +2042,17 @@ public class JackIrBuilder { @Override public boolean visit(QualifiedAllocationExpression allocation, BlockScope scope) { ReferenceBinding allocated = allocation.binding.declaringClass; - // STOPSHIP Check error cases and report error to the user + if (allocation.enclosingInstance != null && !isNested(allocated)) { + ReferenceBinding targetType; + if (allocated.isAnonymousType()) { + targetType = (ReferenceBinding) allocated.superclass().erasure(); + } else { + targetType = allocated; + } + scope.problemReporter().unnecessaryEnclosingInstanceSpecification(allocation, + targetType); + throw new FrontendCompilationError(); + } return super.visit(allocation, scope); } |