You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2016/01/08 12:35:34 UTC

Re: Apache Isis version 1.11.0 JAVA 1.7 Error

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 <n....@gesconsultor.com>
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.
>
>
>
>

RE: Apache Isis version 1.11.0 JAVA 1.7 Error

Posted by Nacho Cánovas Rejón <n....@gesconsultor.com>.
Perfect, I'll update ISIS and seems that I don't have any more problems.

Thanks Dan.

-----Original Message-----
From: Dan Haywood [mailto:dan@haywood-associates.co.uk] 
Sent: domingo, 10 de enero de 2016 17:57
To: users
Subject: Re: Apache Isis version 1.11.0 JAVA 1.7 Error

On 10 January 2016 at 16:52, Martin Grigorov <mg...@apache.org> wrote:

> >
>
> I was confused that Isis moved to 1.8 with 1.10.0, but now I see it is 
> still 1.7 
> (https://github.com/apache/isis/blob/master/core/pom.xml#L60-L61
> )
>
>
Indeed... nothing changed in 1.10.0

It's kind of odd that these settings weren't sufficient to prevent the
error: my understanding was that, even if building with a JDK8 JVM (as I did), that these settings would flag up and prevent any accidental use of
JDK8 APIs.  But obviously not!

Anyway, with toolchains configured the errors that Nacho identified did all get flagged up when I did the build (and obviously I fixed them all before doing the release).  So I am pretty certain that using toolchains will ensure that this issue doesn't arise in the future.

Thx
Dan




>
> >
> >
> > ~~~
> >
> > Meanwhile, I've cut 1.11.1 RC1 we the appropriate fixes, this is now
> being
> > voted on in the dev@ mailing list.  This vote will stay open for min 
> > 72 hours, but if it passes then we should be able to release 1.11.1 
> > on Wed
> pm
> > or Thu am.
> >
> > Thx
> > Dan
> >
> >
> >
> >
> >
> >
> >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Jan 8, 2016 at 12:35 PM, Dan Haywood <
> > dan@haywood-associates.co.uk
> > > >
> > > wrote:
> > >
> > > > 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 < 
> > > > n.canovas@gesconsultor.com>
> > > > 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.htm
> l#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\facet
> s\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\servi
> ces\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.htm
> l
> > > > >
> > > > >
> > >
> https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.htm
> l
> > > > >
> > > > >
> > > > >
> > > > > Best regards and happy new year.
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>


Re: Apache Isis version 1.11.0 JAVA 1.7 Error

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 10 January 2016 at 16:52, Martin Grigorov <mg...@apache.org> wrote:

> >
>
> I was confused that Isis moved to 1.8 with 1.10.0, but now I see it is
> still 1.7 (https://github.com/apache/isis/blob/master/core/pom.xml#L60-L61
> )
>
>
Indeed... nothing changed in 1.10.0

It's kind of odd that these settings weren't sufficient to prevent the
error: my understanding was that, even if building with a JDK8 JVM (as I
did), that these settings would flag up and prevent any accidental use of
JDK8 APIs.  But obviously not!

Anyway, with toolchains configured the errors that Nacho identified did all
get flagged up when I did the build (and obviously I fixed them all before
doing the release).  So I am pretty certain that using toolchains will
ensure that this issue doesn't arise in the future.

Thx
Dan




>
> >
> >
> > ~~~
> >
> > Meanwhile, I've cut 1.11.1 RC1 we the appropriate fixes, this is now
> being
> > voted on in the dev@ mailing list.  This vote will stay open for min 72
> > hours, but if it passes then we should be able to release 1.11.1 on Wed
> pm
> > or Thu am.
> >
> > Thx
> > Dan
> >
> >
> >
> >
> >
> >
> >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Jan 8, 2016 at 12:35 PM, Dan Haywood <
> > dan@haywood-associates.co.uk
> > > >
> > > wrote:
> > >
> > > > 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 <
> > > > n.canovas@gesconsultor.com>
> > > > 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.
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: Apache Isis version 1.11.0 JAVA 1.7 Error

Posted by Martin Grigorov <mg...@apache.org>.
On Sun, Jan 10, 2016 at 5:36 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> On 8 January 2016 at 11:46, Martin Grigorov <mg...@apache.org> wrote:
>
> > Hi,
> >
> > If Java 7 is the minimum supported then why not use Java 7 to build? This
> > is the cleanest way to make sure everything is fine.
> >
> >
> I've decided to use the maven-toolchains-plugin.
>
>
>
>
> > I thought that Java 8 is the minimum since a while.
> >
> >
> Nope, not yet.  My opinion is that we shouldn't drop Java 7 until Java 9
> has been released (Q1 2017 being the current date for that).
>

I was confused that Isis moved to 1.8 with 1.10.0, but now I see it is
still 1.7 (https://github.com/apache/isis/blob/master/core/pom.xml#L60-L61)


>
>
> ~~~
>
> Meanwhile, I've cut 1.11.1 RC1 we the appropriate fixes, this is now being
> voted on in the dev@ mailing list.  This vote will stay open for min 72
> hours, but if it passes then we should be able to release 1.11.1 on Wed pm
> or Thu am.
>
> Thx
> Dan
>
>
>
>
>
>
>
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Jan 8, 2016 at 12:35 PM, Dan Haywood <
> dan@haywood-associates.co.uk
> > >
> > wrote:
> >
> > > 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 <
> > > n.canovas@gesconsultor.com>
> > > 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.
> > > >
> > > >
> > > >
> > > >
> > >
> >
>

Re: Apache Isis version 1.11.0 JAVA 1.7 Error

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 8 January 2016 at 11:46, Martin Grigorov <mg...@apache.org> wrote:

> Hi,
>
> If Java 7 is the minimum supported then why not use Java 7 to build? This
> is the cleanest way to make sure everything is fine.
>
>
I've decided to use the maven-toolchains-plugin.




> I thought that Java 8 is the minimum since a while.
>
>
Nope, not yet.  My opinion is that we shouldn't drop Java 7 until Java 9
has been released (Q1 2017 being the current date for that).


~~~

Meanwhile, I've cut 1.11.1 RC1 we the appropriate fixes, this is now being
voted on in the dev@ mailing list.  This vote will stay open for min 72
hours, but if it passes then we should be able to release 1.11.1 on Wed pm
or Thu am.

Thx
Dan







> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Jan 8, 2016 at 12:35 PM, Dan Haywood <dan@haywood-associates.co.uk
> >
> wrote:
>
> > 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 <
> > n.canovas@gesconsultor.com>
> > 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.
> > >
> > >
> > >
> > >
> >
>

Re: Apache Isis version 1.11.0 JAVA 1.7 Error

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

If Java 7 is the minimum supported then why not use Java 7 to build? This
is the cleanest way to make sure everything is fine.

I thought that Java 8 is the minimum since a while.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Jan 8, 2016 at 12:35 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> 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 <
> n.canovas@gesconsultor.com>
> 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.
> >
> >
> >
> >
>