Fix compatibility with JDK9
Cast runtime object retrieved reflectively to their public interface counterpart. See gh-7226
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,7 @@ class ExpressionTree extends ReflectionWrapper {
|
||||
"getInitializers");
|
||||
|
||||
ExpressionTree(Object instance) {
|
||||
super(instance);
|
||||
super("com.sun.source.tree.ExpressionTree", instance);
|
||||
}
|
||||
|
||||
public String getKind() throws Exception {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,14 +31,9 @@ class ReflectionWrapper {
|
||||
|
||||
private final Object instance;
|
||||
|
||||
ReflectionWrapper(Object instance) {
|
||||
this.type = instance.getClass();
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
ReflectionWrapper(String type, Object instance) {
|
||||
this.type = findClass(instance.getClass().getClassLoader(), type);
|
||||
this.instance = instance;
|
||||
this.instance = this.type.cast(instance);
|
||||
}
|
||||
|
||||
protected final Object getInstance() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ import javax.lang.model.element.Element;
|
||||
final class Trees extends ReflectionWrapper {
|
||||
|
||||
private Trees(Object instance) {
|
||||
super(instance);
|
||||
super("com.sun.source.util.Trees", instance);
|
||||
}
|
||||
|
||||
public Tree getTree(Element element) throws Exception {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ import javax.lang.model.element.Modifier;
|
||||
class VariableTree extends ReflectionWrapper {
|
||||
|
||||
VariableTree(Object instance) {
|
||||
super(instance);
|
||||
super("com.sun.source.tree.VariableTree", instance);
|
||||
}
|
||||
|
||||
public String getName() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user