Skip to content

Commit 29c30a9

Browse files
Copilotlaeubi
andcommitted
Add N&N entry for improved access restriction warnings
Co-authored-by: laeubi <[email protected]>
1 parent ff5435e commit 29c30a9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

news/4.38/jdt.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ A special thanks to everyone who [contributed to JDT](acknowledgements.md#java-d
2525
---
2626
## Java Compiler
2727

28+
### Changed Handling of Access Restriction for Inherited Methods
29+
<!-- https://github.com/eclipse-jdt/eclipse.jdt.core/pull/4293 -->
30+
<details>
31+
<summary>Contributors</summary>
32+
33+
- [Christoph Laeubrich](https://github.com/laeubi)
34+
- [Stephan Herrmann](https://github.com/stephan-herrmann)
35+
</details>
36+
37+
The Java compiler now handles access restriction warnings different than before when calling inherited methods.
38+
Previously, calling a public method on an accessible type would trigger an access restriction warning if that method was inherited from a restricted (non-API) parent class.
39+
40+
With this change, the compiler recognizes that inherited public methods accessed through an accessible type are legal and do not require access to the restricted parent class.
41+
This behavior now more aligns with JPMS and OSGi semantics, where inherited public methods are accessible through the public subclass without requiring visibility to the parent class's package.
42+
43+
Implementers of `IClasspathConainer` are advised to revisit their usage of access restrictions to see if this new concepts still meets their expectations or possibly need adaption.
44+
2845
### Multi-Release JAR Compilation Support
2946
<!-- https://github.com/eclipse-jdt/eclipse.jdt.core/pull/3900 -->
3047
<!-- https://github.com/eclipse-jdt/eclipse.jdt.ui/pull/2260 -->

0 commit comments

Comments
 (0)