commit | eb33fc94dcc0a4fba39b371d032d0224d82ba0f3 | [log] [tgz] |
---|---|---|
author | Stephan Herrmann <stephan.herrmann@berlin.de> | Fri Dec 23 17:43:47 2022 +0100 |
committer | Stephan Herrmann <stephan.herrmann@berlin.de> | Fri Dec 23 17:43:47 2022 +0100 |
tree | 510373e5dda9b21f8b89d4ff1f31047206e2e749 | |
parent | cf6c3b197296320e912da797b43cae2a7cb00e25 [diff] |
BugĀ 581263 - [compiler][otdre] bogus warning against callout to static
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java index 507911e..8759007 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java
@@ -580,10 +580,13 @@ baseSend.accessId = calloutDecl.baseMethodSpec.accessId; baseAccess = baseSend; } else { - if (calloutDecl.baseMethodSpec.isStatic()) + if (calloutDecl.baseMethodSpec.isStatic()) { // we thought we should use an instance // but callout-to-static is sent to the base *class* - receiver = gen.baseTypeReference(baseType); + receiver = baseType instanceof DependentTypeBinding && ((DependentTypeBinding) baseType).hasExplicitAnchor() + ? gen.baseTypeReference(baseType) + : gen.baseNameReference(baseType); + } switch (calloutDecl.baseMethodSpec.implementationStrategy) { case DIRECT: if (calloutDecl.isCalloutToField()) {
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java index 7368e32..aa3e174 100644 --- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java +++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java
@@ -49,7 +49,15 @@ public static Class testClass() { return CalloutMethodBinding.class; } - // an abstract role method is callout-bound via -> to a method in the direct base class + + @Override + protected Map getCompilerOptions() { + Map options = super.getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.ERROR); + return options; + } + + // an abstract role method is callout-bound via -> to a method in the direct base class // 3.1.1-otjld-abstract-callout-binding-1 public void test311_abstractCalloutBinding1() {