forked from eclipse-jdt/eclipse.jdt.core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[24] don't request access to enclosing class if it's never used
Fixes after re-opening: + essentially revert previous change + replace with specific detection wrt local type alloc in static context Fixes eclipse-jdt#3194
- Loading branch information
1 parent
04ec289
commit 4ae6fb9
Showing
11 changed files
with
133 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ | |
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* This is an implementation of an early-draft specification developed under the Java | ||
* Community Process (JCP) and is made available for testing and evaluation purposes | ||
* only. The code is not compatible with any specification of the JCP. | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
* Stephan Herrmann <[email protected]> - Contributions for | ||
|
@@ -921,22 +925,18 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo f | |
if ((this.bits & Binding.FIELD) != 0) { | ||
FieldBinding fieldBinding = (FieldBinding) this.binding; | ||
FieldBinding codegenField = fieldBinding.original(); | ||
if ((this.bits & ASTNode.DepthMASK) != 0) { | ||
if ((codegenField.isPrivate() // private access | ||
&& !currentScope.enclosingSourceType().isNestmateOf(codegenField.declaringClass)) | ||
|| (codegenField.isProtected() // implicit protected access | ||
&& codegenField.declaringClass.getPackage() != currentScope.enclosingSourceType().getPackage())) { | ||
if (this.syntheticAccessors == null) | ||
this.syntheticAccessors = new MethodBinding[2]; | ||
this.syntheticAccessors[isReadAccess ? SingleNameReference.READ : SingleNameReference.WRITE] = | ||
((SourceTypeBinding) currentScope.enclosingSourceType(). | ||
enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT)).addSyntheticMethod(codegenField, isReadAccess, false /* not super access */); | ||
currentScope.problemReporter().needToEmulateFieldAccess(codegenField, this, isReadAccess); | ||
return; | ||
} | ||
if (!codegenField.isStatic() && currentScope.enclosingSourceType() instanceof NestedTypeBinding nestedType) { | ||
nestedType.requestEnclosingInstancePathTo(codegenField.declaringClass); | ||
} | ||
if (((this.bits & ASTNode.DepthMASK) != 0) | ||
&& ((codegenField.isPrivate() // private access | ||
&& !currentScope.enclosingSourceType().isNestmateOf(codegenField.declaringClass) ) | ||
|| (codegenField.isProtected() // implicit protected access | ||
&& codegenField.declaringClass.getPackage() != currentScope.enclosingSourceType().getPackage()))) { | ||
if (this.syntheticAccessors == null) | ||
this.syntheticAccessors = new MethodBinding[2]; | ||
this.syntheticAccessors[isReadAccess ? SingleNameReference.READ : SingleNameReference.WRITE] = | ||
((SourceTypeBinding)currentScope.enclosingSourceType(). | ||
enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT)).addSyntheticMethod(codegenField, isReadAccess, false /*not super access*/); | ||
currentScope.problemReporter().needToEmulateFieldAccess(codegenField, this, isReadAccess); | ||
return; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters