Hi Lincoln,<div><br></div><div>I'm hacking now a solution. Something like:</div><div><br></div><div>if (Types.isArray(simpleName))</div><div>{</div><div><div> Name name = ast.newSimpleName(Types.stripArray(simpleName));</div>
<div> Type typeOfArray = ast.newSimpleType(name);</div></div><div> type = ast.newArrayType(typeNoArray);</div><div>}<br><br>I'm just trying to find the most suitable place of the above snippet in the setType method. Maybe I'll do some refactoring of the existing code.</div>
<div><br></div><div> I noticed also that the code inside:</div><div><br></div><div><div> if (!Strings.areEqual(typeName, simpleName) && requiresImport)</div><div><br></div><div>...should also be touched to support arrays.</div>
<div><br></div><div>BTW, we have the same issue with generic types as well. So I'm looking into them too.</div><div><br></div><div>Cheers,</div><div>Ivan</div><div><br></div>P.S. Don't you think that we should have the simple name (e.g. File) in the field declaration instead of the whole type:</div>
<div><br></div><div>right now it is:</div><div><br></div><div>import java.io.File;</div><div><br></div><div>public class Test {</div><div><br></div><div> private java.io.File file;</div><div><br></div><div>}</div><div><br>
<div class="gmail_quote">On Mon, Jul 23, 2012 at 5:53 PM, Lincoln Baxter, III <span dir="ltr"><<a href="mailto:lincolnbaxter@gmail.com" target="_blank">lincolnbaxter@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey Ivan!<br><br>You're correct, the JDT probably doesn't have a convenient method for this (it doesn't have much that is convenient,) but what are your proposed changes? <br><br>~Lincoln<br><br><div class="gmail_quote">
<div><div class="h5">
On Sat, Jul 21, 2012 at 4:04 PM, Ivan St. Ivanov <span dir="ltr"><<a href="mailto:ivan.st.ivanov@gmail.com" target="_blank">ivan.st.ivanov@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
Hi folks,<div><br></div><div>I wonder is it possible to add a field to a JavaClass and to set an array as its type. The setType(String) method does not support arrays yet and I don't want to use the other two variants of this method (taking Class and JavaResource parameters).</div>
<div><br></div><div>I looked at the mentioned method (setType(String)). And found a suitable place where I could add the support for arrays. However, I'm afraid that JDT's AST class does not have a convenient newArray....() method.</div>
<div><br></div><div>Or maybe I'm missing something?</div><div><br></div><div>Cheers,</div><div>Ivan</div>
<br></div></div>_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br>Lincoln Baxter, III<br><a href="http://ocpsoft.org" target="_blank">http://ocpsoft.org</a><br>"Simpler is better."<br>
</font></span><br>_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
<br></blockquote></div><br></div>