eclipse-xtext / eclipse-xtext/xtext
No Import Access Checks
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
Xtend does not check visibility for imports. It thus generates not-compilable Java out of compilable Xtend. Consider the following examples:
package packageA
final package class Foo {
def static bar(Object o) {
}
def instanceBar() {
}
}
package packageB;
import static packageA.Foo.*
public class ImportTest {
def badUsage() {
bar("")
}
}
This does not create any errors in Xtend, even though Foo is not visible from ImportTest. When building these classes, the corresponding Java code is erroneous:
Java problem: The type packageA.Foo is not visible
and
Java problem: Foo cannot be resolved
Similar errors occur for
package packageB;
import packageA.Foo;
public class ImportTest {
def badUsage() {
new Foo().instanceBar()
}
}
and
package packageB;
import static extension packageA.Foo.*;
public class ImportTest {
def badUsage() {
"".bar
}
}
Neither of these examples produce Xtend errors.
I’m using Xtend IDE version 2.12.0.v20170519-1412
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the three import examples in the Xtend IDE or build and compare the results with the Java compiler errors described in the issue. Trace the import resolution and visibility-checking entry points, then add validation so inaccessible imports and their usages produce Xtend errors before Java generation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100