New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run example with version v3.0 ,but now error on v2.1 #23

Open
chengxuwei opened this Issue Jan 23, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@chengxuwei

chengxuwei commented Jan 23, 2017

Exception in thread "main" java.lang.NoSuchMethodError: java.lang.reflect.Field.getDeclaredAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
at org.statefulj.persistence.StateFieldAccessor.init(StateFieldAccessor.java:27)
at org.statefulj.common.utils.FieldAccessor.(FieldAccessor.java:35)
at org.statefulj.persistence.StateFieldAccessor.(StateFieldAccessor.java:22)
at org.statefulj.persistence.memory.MemoryPersisterImpl.initStateFieldAccessor(MemoryPersisterImpl.java:157)
at org.statefulj.persistence.memory.MemoryPersisterImpl.getStateFieldAccessor(MemoryPersisterImpl.java:150)
at org.statefulj.persistence.memory.MemoryPersisterImpl.getCurrent(MemoryPersisterImpl.java:112)
at org.statefulj.fsm.FSM.getCurrentState(FSM.java:200)
at org.statefulj.fsm.FSM.onEvent(FSM.java:115)
at com.jimi.fsm.App.main(App.java:100)

@chengxuwei chengxuwei changed the title from run with example with version v3.0 to run example with version v3.0 Jan 23, 2017

@chengxuwei chengxuwei changed the title from run example with version v3.0 to run example with version v3.0 ,but now error on v2.1 Jan 23, 2017

@chengxuwei

This comment has been minimized.

chengxuwei commented Jan 23, 2017

modify State state = field.getDeclaredAnnotation(State.class);
to:
State state = field.getAnnotation(State.class);

@supercoffee

This comment has been minimized.

supercoffee commented Feb 17, 2017

I also ran into this using version 3.0 on Android. The method getDeclaredAnnotation(Class<T> annotationClass) was added in Java 8. Usage of this method prevents the library from running at all on Java versions <8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment