Bugs
Jan Lahoda
jan.lahoda at oracle.com
Sun Mar 15 18:22:08 UTC 2015
On 13.3.2015 19:06, Robert Field wrote:
>
> On 03/13/15 08:22, andrei.eremeev wrote:
>> Hi REPL team,
>>
>> Found bugs:
>>
>> 1. In completion analysis possible packages are not suggested. "import
>> java.ut|".
>
> Jan?
Two problems here (thanks for report!):
-the completion did not complete packages in any context. Should be
fixed now (is a little bit tricky, as it is not easy to get the list of
packages, so completion is listing classes using the JavaFileManager).
-completion misbehaving for imports in some cases (in particular for
import static). To fix this, I'd like to change the way AnalyzeTask sets
AnalyzeTask.cut like this:
diff -r c9b090dded9b repl/src/impl/TaskFactory.java
--- a/repl/src/impl/TaskFactory.java Sun Mar 15 17:10:33 2015 +0100
+++ b/repl/src/impl/TaskFactory.java Sun Mar 15 19:16:09 2015 +0100
@@ -130,11 +130,9 @@
AnalyzeTask(OuterWrap wrap, String... extraOptions) {
super(wrap, extraOptions);
- Iterator<? extends Element> eit = analyze().iterator();
- if (eit.hasNext()) {
- Element e = eit.next();
- TreePath cutp = trees().getPath(e);
- this.cut = cutp.getCompilationUnit();
+ Iterator<? extends CompilationUnitTree> cuts =
analyze().iterator();
+ if (cuts.hasNext()) {
+ this.cut = cuts.next();
//proc.debug("AnalyzeTask element=%s cutp=%s
cut=%s\n", e, cutp, cut);
} else {
this.cut = null;
@@ -142,9 +140,11 @@
}
}
- private Iterable<? extends Element> analyze() {
+ private Iterable<? extends CompilationUnitTree> analyze() {
try {
- return task.analyze();
+ Iterable<? extends CompilationUnitTree> cuts =
task.parse();
+ task.analyze();
+ return cuts;
} catch (Exception ex) {
throw new InternalError("Exception during analyze - "
+ ex.getMessage(), ex);
}
Does this seem OK?
Thanks,
Jan
>
>> 2. A user defined method/variable cannot hide a method/field which has
>> been imported. (Maybe, a duplicate)
>> See ReplaceTest#testForwardSingleImportFieldToMethod, ReplaceTest#
>> testForwardSingleImportMethodToMethod
>
> That is a duplicate, but I figured out a way to fix it. So far fixed
> for star imports. Still need to fix for named imports.
>
> Tests reenabled.
>
>>
>> 3. This may not be a bug. Anyway, eval() returns string in quotes for
>> String type.
>
> I sent a query about desired proper behavior here. Got no responses.
> So, I'm leaving it, for now.
>
> -Robert
>
>>
>> Andrei Eremeev
>
More information about the kulla-dev
mailing list