-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fields using static inner classes with same name generate overlapping imports #154
Comments
Can confirm for 4.2.2. The builder generated for A in the example project looks like this: package a;
import a.b.B.Inner;
import a.b.C.Inner;
import java.util.List;
import javax.annotation.Generated;
import net.karneim.pojobuilder.GwtIncompatible;
@Generated("PojoBuilder")
public class ABuilder
implements Cloneable {
protected ABuilder self;
protected List<Inner> value$bs$java$util$List;
protected boolean isSet$bs$java$util$List;
protected List<Inner> value$cs$java$util$List;
protected boolean isSet$cs$java$util$List;
/**
* Creates a new {@link ABuilder}.
*/
public ABuilder() {
self = (ABuilder)this;
}
/**
* Sets the default value for the {@link A#bs} property.
*
* @param value the default value
* @return this builder
*/
public ABuilder withBs(List<Inner> value) {
this.value$bs$java$util$List = value;
this.isSet$bs$java$util$List = true;
return self;
}
/**
* Sets the default value for the {@link A#cs} property.
*
* @param value the default value
* @return this builder
*/
public ABuilder withCs(List<Inner> value) {
this.value$cs$java$util$List = value;
this.isSet$cs$java$util$List = true;
return self;
}
/**
* Returns a clone of this builder.
*
* @return the clone
*/
@Override
@GwtIncompatible
public Object clone() {
try {
ABuilder result = (ABuilder)super.clone();
result.self = result;
return result;
} catch (CloneNotSupportedException e) {
throw new InternalError(e.getMessage());
}
}
/**
* Returns a clone of this builder.
*
* @return the clone
*/
@GwtIncompatible
public ABuilder but() {
return (ABuilder)clone();
}
/**
* Creates a new {@link A} based on this builder's settings.
*
* @return the created A
*/
public A build() {
try {
A result = new A();
if (isSet$bs$java$util$List) {
result.bs = value$bs$java$util$List;
}
if (isSet$cs$java$util$List) {
result.cs = value$cs$java$util$List;
}
return result;
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
} Class A: package a;
import java.util.List;
import a.b.B;
import a.b.C;
import net.karneim.pojobuilder.GeneratePojoBuilder;
@GeneratePojoBuilder
public class A {
List<B.Inner> bs;
List<C.Inner> cs;
} |
Adrodoc
added a commit
to Adrodoc/pojobuilder
that referenced
this issue
Dec 29, 2018
…enerate overlapping imports
Adrodoc
added a commit
to Adrodoc/pojobuilder
that referenced
this issue
Dec 29, 2018
…enerate overlapping imports
mkarneim
added a commit
that referenced
this issue
Mar 10, 2019
mkarneim
added a commit
that referenced
this issue
Mar 10, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
E.g.
where classes
B
andC
contain a static inner classInner
.Example project: https://github.com/chrismanning/pojobuilder-static-inner-class
Similar to #150 but not quite the same and this still occurs in 4.2.2
The text was updated successfully, but these errors were encountered: