diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-23 19:13:03 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-23 19:13:03 +0200 |
commit | e85ef24b4d99f922f77439d9ba5e0e27717f2d31 (patch) | |
tree | 577c4693074cd289fe9103f4bec836fd2974ad35 /src/lombok/eclipse/Eclipse.java | |
parent | 8bbdcec6fad6edf8f335f9e0c6899fddc56e07c1 (diff) | |
download | lombok-e85ef24b4d99f922f77439d9ba5e0e27717f2d31.tar.gz lombok-e85ef24b4d99f922f77439d9ba5e0e27717f2d31.tar.bz2 lombok-e85ef24b4d99f922f77439d9ba5e0e27717f2d31.zip |
Fixed some bugs in copyType(), and now the static constructor is generated without any raw generics warnings - it is effectively done.
Diffstat (limited to 'src/lombok/eclipse/Eclipse.java')
-rw-r--r-- | src/lombok/eclipse/Eclipse.java | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/lombok/eclipse/Eclipse.java b/src/lombok/eclipse/Eclipse.java index e717e491..67622e47 100644 --- a/src/lombok/eclipse/Eclipse.java +++ b/src/lombok/eclipse/Eclipse.java @@ -106,17 +106,17 @@ public class Eclipse { return out; } - public static TypeReference copyType(TypeReference ref) { - if ( ref instanceof QualifiedTypeReference ) { - QualifiedTypeReference iRef = (QualifiedTypeReference) ref; - return new QualifiedTypeReference(iRef.tokens, iRef.sourcePositions); - } - - if ( ref instanceof ArrayQualifiedTypeReference ) { - ArrayQualifiedTypeReference iRef = (ArrayQualifiedTypeReference) ref; - return new ArrayQualifiedTypeReference(iRef.tokens, iRef.dimensions(), iRef.sourcePositions); + public static TypeReference[] copyTypes(TypeReference[] refs) { + if ( refs == null ) return null; + TypeReference[] outs = new TypeReference[refs.length]; + int idx = 0; + for ( TypeReference ref : refs ) { + outs[idx++] = copyType(ref); } - + return outs; + } + + public static TypeReference copyType(TypeReference ref) { if ( ref instanceof ParameterizedQualifiedTypeReference ) { ParameterizedQualifiedTypeReference iRef = (ParameterizedQualifiedTypeReference) ref; TypeReference[][] args = null; @@ -138,14 +138,14 @@ public class Eclipse { return new ParameterizedQualifiedTypeReference(iRef.tokens, args, iRef.dimensions(), iRef.sourcePositions); } - if ( ref instanceof SingleTypeReference ) { - SingleTypeReference iRef = (SingleTypeReference) ref; - return new SingleTypeReference(iRef.token, (long)iRef.sourceStart << 32 | iRef.sourceEnd); + if ( ref instanceof ArrayQualifiedTypeReference ) { + ArrayQualifiedTypeReference iRef = (ArrayQualifiedTypeReference) ref; + return new ArrayQualifiedTypeReference(iRef.tokens, iRef.dimensions(), iRef.sourcePositions); } - if ( ref instanceof ArrayTypeReference ) { - ArrayTypeReference iRef = (ArrayTypeReference) ref; - return new ArrayTypeReference(iRef.token, iRef.dimensions(), (long)iRef.sourceStart << 32 | iRef.sourceEnd); + if ( ref instanceof QualifiedTypeReference ) { + QualifiedTypeReference iRef = (QualifiedTypeReference) ref; + return new QualifiedTypeReference(iRef.tokens, iRef.sourcePositions); } if ( ref instanceof ParameterizedSingleTypeReference ) { @@ -162,10 +162,20 @@ public class Eclipse { return new ParameterizedSingleTypeReference(iRef.token, args, iRef.dimensions(), (long)iRef.sourceStart << 32 | iRef.sourceEnd); } + if ( ref instanceof ArrayTypeReference ) { + ArrayTypeReference iRef = (ArrayTypeReference) ref; + return new ArrayTypeReference(iRef.token, iRef.dimensions(), (long)iRef.sourceStart << 32 | iRef.sourceEnd); + } + if ( ref instanceof Wildcard ) { return new Wildcard(((Wildcard)ref).kind); } + if ( ref instanceof SingleTypeReference ) { + SingleTypeReference iRef = (SingleTypeReference) ref; + return new SingleTypeReference(iRef.token, (long)iRef.sourceStart << 32 | iRef.sourceEnd); + } + return ref; } |