Skip to content

Commit

Permalink
ROASTER-21: Support for JLS8
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jul 14, 2014
1 parent 1a58763 commit 3bd7cbe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Expand Up @@ -39,7 +39,7 @@ public static String getTypeName(final Type type)
}
else if (type instanceof ArrayType)
{
return ((ArrayType) type).getStructuralProperty(ArrayType.COMPONENT_TYPE_PROPERTY).toString();
return ((ArrayType) type).getStructuralProperty(ArrayType.ELEMENT_TYPE_PROPERTY).toString();
}
else if (type instanceof QualifiedType)
{
Expand Down
Expand Up @@ -523,8 +523,8 @@ public MethodSource<O> addThrows(final String type)

SimpleName simpleName = method.getAST().newSimpleName(name);

List list = (List) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY);
list.add(simpleName);
List list = (List) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY);
list.add(method.getAST().newSimpleType(simpleName));

return this;
}
Expand All @@ -533,7 +533,7 @@ public MethodSource<O> addThrows(final String type)
public List<String> getThrownExceptions()
{
ArrayList<String> result = new ArrayList<String>();
List<?> list = (List<?>) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY);
List<?> list = (List<?>) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY);

for (Object object : list)
{
Expand All @@ -552,7 +552,7 @@ public MethodSource<O> removeThrows(final Class<? extends Exception> type)
@Override
public MethodSource<O> removeThrows(final String type)
{
List<?> list = (List<?>) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY);
List<?> list = (List<?>) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY);

for (Object object : list)
{
Expand Down
Expand Up @@ -90,7 +90,7 @@ public List<Type<O>> getTypeArguments()

if (type.isArrayType())
{
type = ((ArrayType) type).getComponentType();
type = ((ArrayType) type).getElementType();
}

if (type instanceof ParameterizedType)
Expand All @@ -117,7 +117,7 @@ public boolean isParameterized()
{
if (type.isArrayType())
{
return ((ArrayType) type).getComponentType().isParameterizedType();
return ((ArrayType) type).getElementType().isParameterizedType();
}
return type.isParameterizedType();
}
Expand All @@ -127,7 +127,7 @@ public boolean isPrimitive()
{
if (type.isArrayType())
{
return ((ArrayType) type).getComponentType().isPrimitiveType();
return ((ArrayType) type).getElementType().isPrimitiveType();
}
return type.isPrimitiveType();
}
Expand All @@ -137,7 +137,7 @@ public boolean isQualified()
{
if (type.isArrayType())
{
return ((ArrayType) type).getComponentType().isQualifiedType();
return ((ArrayType) type).getElementType().isQualifiedType();
}
return type.isQualifiedType();
}
Expand All @@ -147,7 +147,7 @@ public boolean isWildcard()
{
if (type.isArrayType())
{
return ((ArrayType) type).getComponentType().isWildcardType();
return ((ArrayType) type).getElementType().isWildcardType();
}
return type.isWildcardType();
}
Expand Down
Expand Up @@ -69,11 +69,11 @@ public JavaType<?> parse(final InputStream data)
private JavaType<?> parse(final String data)
{
Document document = new Document(data);
ASTParser parser = ASTParser.newParser(AST.JLS4);
ASTParser parser = ASTParser.newParser(AST.JLS8);

parser.setSource(document.get().toCharArray());
Map options = JavaCore.getOptions();
options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7);
options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8);
options.put(CompilerOptions.OPTION_Encoding, "UTF-8");
parser.setCompilerOptions(options);

Expand Down

0 comments on commit 3bd7cbe

Please sign in to comment.