[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jdt-dev] Bug in JDT causes invalid class files generated by EJC (javac works fine) and faulty code actions
|
Hi Stephan,
one might argue about the style but nerveless javac produces the desired
results, and ecj produces a result that only fails at runtime with
IllegalAccessError, so I would call it a bug (maybe in javac then) :-)
You even have quoted already the javaspec that this is actually allowed,
so I can't see any choice here, especially if the only difference is how
the type is referenced:
--
a.b.c.myStatic() --> works
--
--
import static a.b.c.myStatic;
myStatic() --> fails
--
so again here I would expect the same results and (as a user) would
suspect a bug.
Whether or not replacing it with the super-type is valid is nothing I
could decide on but at least the result is something that could be
executed so not part of the problem here.
Am 08.03.23 um 16:07 schrieb Stephan Herrmann:
In my understanding, the code generation part is not explicitly
specified, so speaking of a "bug" is problematic, it's more like a free
choice made decades ago, that *now* proves unfortunate.
Furthermore, I doubt that the pattern of accessing a static member of an
inaccessible type via a public subclass is intended use of the feature,
to me it feels more like an accident that this pattern works.
Inheritance (an OO feature) for static (non-OO) members looks more like
an after thought than a carefully designed feature, if you ask me.
I'm elaborating these aspects simply to point out, that the situation is
a questionable corner case. I'm willing to continue providing pointers
and hints, but I believe the required changes need to come from the
affected communities.
best,
Stephan
Am 08.03.23 um 10:07 schrieb Christoph Läubrich:
Hi JDT devs,
I'd like to raise your awareness on a family of bugs I have described
here [1], [2], [3].
To summarize, jdt creates non working class files when a static import
is used that targets a package private class enhanced by a public one.
In this case the following issues happen (in descending severity):
- the compiled class files contain wrong references and an
IllegalAccessError is thrown at runtime , even in cases where the IDE
did not give any error/warning [1]
- Organize imports creates wrong results [2]
- Wrong warning is emitted about indirect static access [3]
This currently blocks adoption of Project Panama[4] and jextract [5]
for any project using Eclipse/JDT, but as well hinders us to improve
code in other areas (e.g. SWT).
As both things are likely to approach in this release, it would be
great if these bugs can be addressed soon, I have provided simple
reproducer projects and description how to show the behavior, if any
information is missing please let me know in the referenced issues.
thanks in advance
Christoph
[1] https://github.com/eclipse-jdt/eclipse.jdt.core/issues/809
[2] https://github.com/eclipse-jdt/eclipse.jdt.core/issues/814
[3] https://github.com/eclipse-jdt/eclipse.jdt.core/issues/813
[4] https://openjdk.org/projects/panama/
[5] https://jdk.java.net/jextract/
_______________________________________________
jdt-dev mailing list
jdt-dev@xxxxxxxxxxx
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jdt-dev
_______________________________________________
jdt-dev mailing list
jdt-dev@xxxxxxxxxxx
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jdt-dev