[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by Kai Müller (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
Kai Müller commented on ROASTER-4:
----------------------------------
Hi, I need some help with jdt:
I currently try to add the generic type to a class with this code, but it fails, because the simple name if the class has already a parent, which I can't delete.
{code:java}
ParameterizedType pt = body.getAST().newParameterizedType(
body.getAST().newSimpleType(getBodyDeclaration().getName()));
org.eclipse.jdt.core.dom.Type t = fromString(Types.toSimpleName(clazz.getName()), body.getAST());
System.out.println(t);
pt.typeArguments().add(t);
{code}
{code:java}
final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
javaClass.setName("Teest");
javaClass.addGenericType(String.class);
System.out.println(javaClass);
{code}
Can somebody please assist how to do this? I basically want to have "public class Test<String>{}"
BR,
Kai
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Assignee: Kai Müller
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by Kai Müller (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
Kai Müller reassigned ROASTER-4:
--------------------------------
Assignee: Kai Müller
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Assignee: Kai Müller
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by Kai Müller (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
Kai Müller edited comment on ROASTER-4 at 1/23/19 4:10 PM:
-----------------------------------------------------------
[~gastaldi]: I'll implement the methods described above in the next time
was (Author: kaijmueller):
I just mentioned that the support for wildcards would be needed for types and not for classes, methods, etc... --> no need to implement this now
[~gastaldi]: I'll implement the methods described above in the next time
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by Kai Müller (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
Kai Müller edited comment on ROASTER-4 at 1/23/19 4:10 PM:
-----------------------------------------------------------
Sure.
I did some testing and it seems that addTypeVariable is the right method to use this. The following should be implemented
* addTypeVariable (Class)
* addTypeVariable().setName(Class)
What do you think? The name is no the best, but it should be okay. Else I could add some default methods which act as an alias.
was (Author: kaijmueller):
Sure.
I did some testing and it seems that addTypeVariable is the right method to use this. The following should be implemented
* addTypeVariable (Class)
* addTypeVariable().setName(Class)
What do you think? The name is no the best, but it should be okay. Else I could add some default methods which act as an alias.
I discovered a feature gap, that wildcards (?) are not supported. To enable this, we need to use https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%....
If you think that's feasible, I'll implement this in the next time.
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by Kai Müller (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
Kai Müller edited comment on ROASTER-4 at 1/23/19 4:01 PM:
-----------------------------------------------------------
I just mentioned that the support for wildcards would be needed for types and not for classes, methods, etc... --> no need to implement this now
[~gastaldi]: I'll implement the methods described above in the next time
was (Author: kaijmueller):
I just mentioned that the support for wildcards would be needed for types and not for classes, methods, etc...
[~gastaldi]: I'll implement the methods described above in the next time
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by Kai Müller (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
Kai Müller edited comment on ROASTER-4 at 1/23/19 4:01 PM:
-----------------------------------------------------------
I just mentioned that the support for wildcards would be needed for types and not for classes, methods, etc...
[~gastaldi]: I'll implement the methods described above in the next time
was (Author: kaijmueller):
[~gastaldi]: What now exactly? Do you mean the first or second part :-)
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by Kai Müller (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
Kai Müller commented on ROASTER-4:
----------------------------------
[~gastaldi]: What now exactly? Do you mean the first or second part :-)
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-23) Forge JavaParser does not support Wildcard Imports "org.jboss.forge.*"
by George Gastaldi (Jira)
[ https://issues.jboss.org/browse/ROASTER-23?page=com.atlassian.jira.plugin... ]
George Gastaldi closed ROASTER-23.
----------------------------------
Fix Version/s: 2.20.9.Final
(was: 2.x Future)
Resolution: Done
> Forge JavaParser does not support Wildcard Imports "org.jboss.forge.*"
> ----------------------------------------------------------------------
>
> Key: ROASTER-23
> URL: https://issues.jboss.org/browse/ROASTER-23
> Project: Roaster
> Issue Type: Enhancement
> Reporter: Lincoln Baxter III
> Assignee: Kai Müller
> Priority: Major
> Fix For: 2.20.9.Final
>
>
> The JavaParser Annotation.getQualifiedName() will return "Column" instead of "javax.persistence.Column" for the following example class scenario. It should be able to understand the wildcard, given the proper metadata:
> {code}package demo.entities;
> import javax.persistence.*;
> @Entity
> public class Contact implements java.io.Serializable {
> @Id
> private @GeneratedValue(strategy = GenerationType.AUTO)
> @Column(name = "id", updatable = false, nullable = false)
> Long id = null;
> @Version
> private @Column(name = "version")
> int version = 0;
> public Long getId() {
> return this.id;
> }
> public void setId(final Long id) {
> this.id = id;
> }
> public int getVersion() {
> return this.version;
> }
> public void setVersion(final int version) {
> this.version = version;
> }
> @Override
> public boolean equals(Object that) {
> if (this == that) {
> return true;
> }
> if (that == null) {
> return false;
> }
> if (getClass() != that.getClass()) {
> return false;
> }
> if (id != null) {
> return id.equals(((Contact) that).id);
> }
> return super.equals(that);
> }
> @Override
> public int hashCode() {
> if (id != null) {
> return id.hashCode();
> }
> return super.hashCode();
> }
> private String name;
> public String getName() {
> return this.name;
> }
> public void setName(final String name) {
> this.name = name;
> }
> public String toString() {
> return "" + name;
> }
> }{code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by George Gastaldi (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
George Gastaldi commented on ROASTER-4:
---------------------------------------
[~kaijmueller] +1, sounds good to me
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months
[JBoss JIRA] (ROASTER-4) Having Parameterize interface bit more typed
by Kai Müller (Jira)
[ https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin.... ]
Kai Müller edited comment on ROASTER-4 at 1/23/19 2:50 PM:
-----------------------------------------------------------
Sure.
I did some testing and it seems that addTypeVariable is the right method to use this. The following should be implemented
* addTypeVariable (Class)
* addTypeVariable().setName(Class)
What do you think? The name is no the best, but it should be okay. Else I could add some default methods which act as an alias.
I discovered a feature gap, that wildcards (?) are not supported. To enable this, we need to use https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%....
If you think that's feasible, I'll implement this in the next time.
was (Author: kaijmueller):
Sure.
I did some testing and it seems that addTypeVariable is the right method to use this. The following should be implemented
* addTypeVariable (Class)
* addTypeVariable().setName(Class)
What do you think? The name is no the best, but it should be okay. Else I could add some default methods which act as an alias.
I discovered a feature gap, that wildcards (?) are not supported. To enable this, we need to use https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%....
If you think that's feasible, I'll implement this in the next time.
> Having Parameterize interface bit more typed
> --------------------------------------------
>
> Key: ROASTER-4
> URL: https://issues.jboss.org/browse/ROASTER-4
> Project: Roaster
> Issue Type: Feature Request
> Components: API
> Affects Versions: 2.1.0.Final
> Reporter: Antonio Goncalves
> Priority: Major
> Fix For: 2.x Future
>
>
> For a constraint, I need to implement a parametrize interface like this :
> {code}
> public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
> {code}
> The only way I could find is by passing a String :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addImport(ConstraintValidator.class);
> javaClass.addInterface("ConstraintValidator<Max, Number>");
> {code}
> It's a shame because with {{addInterface(Class)}}, it does the import automatically and things are more typed. But I cannot add types :
> {code}
> final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
> javaClass.setName("MaxValidatorForString");
> javaClass.addInterface(ConstraintValidator.class);
> {code}
> It would be good to have something like :
> {code}
> javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 10 months