diff --git a/Utilities.iml b/Utilities.iml index 4a751ce..eb6b274 100644 --- a/Utilities.iml +++ b/Utilities.iml @@ -1,6 +1,6 @@ - + diff --git a/src/dorkbox/util/ClassResolver.java b/src/dorkbox/util/ClassResolver.java index 9765d94..b9233e8 100644 --- a/src/dorkbox/util/ClassResolver.java +++ b/src/dorkbox/util/ClassResolver.java @@ -47,3 +47,4 @@ public abstract class ClassResolver { return CALLER_RESOLVER.getClassContext()[CALL_CONTEXT_OFFSET + callerOffset]; } } + diff --git a/src/dorkbox/util/ClassHelper.java b/src/dorkbox/util/generics/ClassHelper.java similarity index 88% rename from src/dorkbox/util/ClassHelper.java rename to src/dorkbox/util/generics/ClassHelper.java index 024c666..dae90b8 100644 --- a/src/dorkbox/util/ClassHelper.java +++ b/src/dorkbox/util/generics/ClassHelper.java @@ -1,19 +1,19 @@ /* - * 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. - * You may obtain a copy of the License at + * 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 + * 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. + * 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; +package dorkbox.util.generics; import java.lang.reflect.Type; diff --git a/src/dorkbox/util/generics/DefaultMethodHelper.java b/src/dorkbox/util/generics/DefaultMethodHelper.java new file mode 100644 index 0000000..a928b80 --- /dev/null +++ b/src/dorkbox/util/generics/DefaultMethodHelper.java @@ -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(); + } +} diff --git a/src/dorkbox/util/TypeResolver.java b/src/dorkbox/util/generics/TypeResolver.java similarity index 97% rename from src/dorkbox/util/TypeResolver.java rename to src/dorkbox/util/generics/TypeResolver.java index 2ccf777..ef2dd0f 100644 --- a/src/dorkbox/util/TypeResolver.java +++ b/src/dorkbox/util/generics/TypeResolver.java @@ -1,21 +1,19 @@ /* - * 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. - * You may obtain a copy of the License at + * 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. - * - * From: https://github.com/jhalterman/typetools + * 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; +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