Added TypeUtilities, moved ClassHelper into it's own package so java 1.8
specific code can be compiled separately.
This commit is contained in:
parent
b96ac4be89
commit
b1872f8cf6
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
|
@ -47,3 +47,4 @@ public abstract class ClassResolver {
|
||||
return CALLER_RESOLVER.getClassContext()[CALL_CONTEXT_OFFSET + callerOffset];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 dorkbox, llc
|
||||
* Copyright 2018 dorkbox, llc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package dorkbox.util;
|
||||
package dorkbox.util.generics;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
29
src/dorkbox/util/generics/DefaultMethodHelper.java
Normal file
29
src/dorkbox/util/generics/DefaultMethodHelper.java
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2018 dorkbox, llc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package dorkbox.util.generics;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* This class must be compiled for java 8+, and is needed by the TypeResolver in some situations
|
||||
*/
|
||||
public
|
||||
class DefaultMethodHelper {
|
||||
static
|
||||
boolean isDefaultMethod(Method m) {
|
||||
return m.isDefault();
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 Jonathan Halterman
|
||||
* Copyright 2018 dorkbox, llc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -12,10 +12,8 @@
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* From: https://github.com/jhalterman/typetools
|
||||
*/
|
||||
package dorkbox.util;
|
||||
package dorkbox.util.generics;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
@ -43,6 +41,7 @@ import sun.misc.Unsafe;
|
||||
/**
|
||||
* Enhanced type resolution utilities.
|
||||
*
|
||||
* From: https://github.com/jhalterman/typetools
|
||||
* @author Jonathan Halterman
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
@ -544,7 +543,7 @@ class TypeResolver {
|
||||
|
||||
private static
|
||||
boolean isDefaultMethod(Method m) {
|
||||
return JAVA_VERSION >= 1.8 && m.isDefault();
|
||||
return JAVA_VERSION >= 1.8 && DefaultMethodHelper.isDefaultMethod(m);
|
||||
}
|
||||
|
||||
private static
|
Loading…
Reference in New Issue
Block a user