| Summary: | [templates] Variable resolver resolves to array of specified type | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Benno Baumgartner <benno.baumgartner> |
| Component: | Text | Assignee: | Markus Keller <markus.kell.r> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | daniel_megert, deepakazad, markus.kell.r |
| Version: | 3.3 | ||
| Target Milestone: | 3.8 M7 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
This doesn't depend on your work for bug 200801, right? (In reply to comment #1) > This doesn't depend on your work for bug 200801, right? > It does not depend on bug 200801. This is a minor bug I found while playing with the templates, it's also in 3.3. I guess the bug is in CompilationUnitCompletion.Variable.isSubtypeOf(String) patch? ;-) (In reply to comment #3) > patch? ;-) > Ooops, this problem is a bit bigger then I thought because a pattern: out(${name:var(java.lang.String[])}); is not valid template syntax. There is a workaround now: out(${name:var('java.lang.String[]')}); but we should change the template syntax to write the first one. But fixing this bug can break existing templates, and it's minor... (In reply to comment #4) > is not valid template syntax. There is a workaround now: > > out(${name:var('java.lang.String[]')}); To make it clear: With workaround I mean it is now possible to write this template. But evaluating the template above does not resolve 'name' to String arrays. Fixed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=5cebfb1d709a8016d876757ac33ff278dfcbd43a and http://git.eclipse.org/c/platform/eclipse.platform.common.git/commit/?id=1645fa21e2b2453126277a6d41baeeb71cc3b5ca The doc fix also includes other corrections. (In reply to comment #4) I didn't touch the template language syntax, so you have to enclose array types in single quotes. This could still be relaxed later if someone finds time to implement it. This would not break existing templates. Markus, the 2 consecutive single quotes on line 1071 in o.e.jdt.ui/plugin.properties cause a chkpii error. (More details on BM) . |
I20070821-0800 Given: package test; public class E01 { public void foo() { String[] strings= null; String string= null; out| } public void out(String s) {} } 1. Add template 'out' to java context with pattern: out(${name:var(java.lang.String)}); 2. Replace '|' with caret 3. Ctrl-Space, Ctrl-Space 4. Enter Is: - string - strings is proposed Should: - string is proposed 'var' template variable doc is: 'Evaluates to a field, local variable or parameter visible in the current scope that is a subtype of the given type.' String[] is not a subtype of String.