Hi Nacho, Thanks for reporting this, which is obviously a problem.
I think we should issue a patch (1.11.1) to fix that. And obviously I need to look at the release procedures so that this error doesn't occur in the future. I'll try to get a vote out this weekend. Thx Dan On 8 January 2016 at 11:28, Nacho Cánovas Rejón <[email protected]> wrote: > Hi everybody. > > > > I updated Apache ISIS version to 1.11 and I have a Java Version Problem. > > > > Apache ISIS is compatible with Java 1.7 and 1.8, but in two changes > (ISIS-1257: c6c3066e3b7e58dc1d338e44ba4ca926dc29d1ef and ISIS-1213: > 6ec46332ef2ad50959148751e90222d13a8eecf3) you use a method that only exists > in Java 1.8 ( > < > https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html#get > ParameterCount--> getParameterCount()) > > > > We don’t want to migrate to 1.8 because it requires so many changes on our > app, so if you can change code to be compatible, these are the changes I > made: > > > > > isis\core\metamodel\src\main\java\org\apache\isis\core\metamodel\facets\Anno > tations.java > > > > private static <T extends Annotation> void appendEvaluators( > > final Class<?> cls, > > final Class<T> annotationClass, > > final List<Evaluator<T>> evaluators) { > > > > for (Method method : cls.getDeclaredMethods()) { > > if(MethodScope.OBJECT.matchesScopeOf(method) && > > method.getParameterCount() > method.getParameterTypes().length == 0) { > > final Annotation annotation = > method.getAnnotation(annotationClass); > > if(annotation != null) { > > evaluators.add(new MethodEvaluator(method, > annotation)); > > } > > } > > } > > > > > isis\core\metamodel\src\main\java\org\apache\isis\core\metamodel\services\co > ntainer\DomainObjectContainerDefault.java > > > > public <T> T mixin(final Class<T> mixinClass, final Object mixedIn) { > > final ObjectSpecification objectSpec = > getSpecificationLoader().loadSpecification(mixinClass); > > final MixinFacet mixinFacet = > objectSpec.getFacet(MixinFacet.class); > > if(mixinFacet == null) { > > throw new NonRecoverableException("Class '" + > mixinClass.getName() + " is not a mixin"); > > } > > if(!mixinFacet.isMixinFor(mixedIn.getClass())) { > > throw new NonRecoverableException("Mixin class '" + > mixinClass.getName() + " is not a mixin for supplied object '" + mixedIn + > "'"); > > } > > final Constructor<?>[] constructors = mixinClass.getConstructors(); > > for (Constructor<?> constructor : constructors) { > > if(constructor.getParameterCount() > constructor.getParameterTypes().length == 1 && > > > constructor.getParameterTypes()[0].isAssignableFrom(mixedIn.getClass())) { > > final Object mixin; > > try { > > mixin = constructor.newInstance(mixedIn); > > return (T)injectServicesInto(mixin); > > } catch (InstantiationException | IllegalAccessException | > InvocationTargetException e) { > > throw new NonRecoverableException(e); > > } > > } > > } > > > > This is the documentation of JAVA with allowed methods depending on > version: > > https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Method.html > > https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html > > > > Best regards and happy new year. > > > >
