Comments (6)
Just FYI, I could not reproduce the issue on Mac OS X (Oracle Java 1.8.0_65-b17). And also, I found a JEP which might be related to this issue, http://openjdk.java.net/jeps/216, which seems included in Java 9.
from agera.
Looks like Travis CI has been running 1.7.0_76-b13, on Linux with no problems. I'm running 1.8.0_92 myself, but that's on OSX. Have you tried the latest version of 1.8 (I guess it's u92?), see if the problem is there too?
#30 from the other week reports the same issue on 1.7.0_79, 1.8.0_66 and 1.8.0_91
from agera.
I tried 1.8.0_92-b14 but had no luck. So was 1.7.0_80-b15. When I compiled the project on Mac, the error didn't occur so it seems the problem is specific to Linux Java. I tried 9-ea+114 and the javac command succeeded but it seems Gradle doesn't support Java 9 yet.
Also, I found if I pulled up com.google.android.agera.Common.WorkerHandler
to, say, com.google.android.agera.WorkerHandler
, the error was gone. So it seems to be related to nested class.
Besides, I found if I deleted the static import statements in com.google.android.agera.Common
, the error r was gone as well:
diff --git a/agera/src/main/java/com/google/android/agera/BaseObservable.java b/agera/src/main/java/com/google/android/agera/BaseObservable.java
index 4938fd1..396cec0 100644
--- a/agera/src/main/java/com/google/android/agera/BaseObservable.java
+++ b/agera/src/main/java/com/google/android/agera/BaseObservable.java
@@ -15,9 +15,6 @@
*/
package com.google.android.agera;
-import static com.google.android.agera.Common.WorkerHandler.MSG_LAST_REMOVED;
-import static com.google.android.agera.Common.WorkerHandler.MSG_UPDATE;
-import static com.google.android.agera.Common.workerHandler;
import static com.google.android.agera.Preconditions.checkState;
import com.google.android.agera.Common.WorkerHandler;
@@ -97,16 +94,16 @@ public abstract class BaseObservable implements Observable {
Worker(@NonNull final BaseObservable baseObservable) {
this.baseObservable = baseObservable;
- this.handler = workerHandler();
+ this.handler = Common.workerHandler();
this.updatablesAndHandlers = NO_UPDATABLES_OR_HANDLERS;
this.size = 0;
}
synchronized void addUpdatable(@NonNull final Updatable updatable) {
- add(updatable, workerHandler());
+ add(updatable, Common.workerHandler());
if (size == 1) {
- if (handler.hasMessages(MSG_LAST_REMOVED, this)) {
- handler.removeMessages(MSG_LAST_REMOVED, this);
+ if (handler.hasMessages(Common.WorkerHandler.MSG_LAST_REMOVED, this)) {
+ handler.removeMessages(Common.WorkerHandler.MSG_LAST_REMOVED, this);
} else {
handler.obtainMessage(WorkerHandler.MSG_FIRST_ADDED, this).sendToTarget();
}
@@ -116,13 +113,13 @@ public abstract class BaseObservable implements Observable {
synchronized void removeUpdatable(@NonNull final Updatable updatable) {
remove(updatable);
if (size == 0) {
- handler.obtainMessage(MSG_LAST_REMOVED, this).sendToTarget();
+ handler.obtainMessage(Common.WorkerHandler.MSG_LAST_REMOVED, this).sendToTarget();
}
}
void dispatchUpdate() {
- if (!handler.hasMessages(MSG_UPDATE, this)) {
- handler.obtainMessage(MSG_UPDATE, this).sendToTarget();
+ if (!handler.hasMessages(Common.WorkerHandler.MSG_UPDATE, this)) {
+ handler.obtainMessage(Common.WorkerHandler.MSG_UPDATE, this).sendToTarget();
}
}
Anyway, I know this is not your code fault. But I think there are a few options for us:
- Reorder the import statements
- Pull up the nested static class
- Delete the static import statements
- Leave it (some Linux users might not be able to compile the code) until Java 9 comes to Gradle
Any idea?
from agera.
I leaning towards 2 (and you're right, 4 is unreasonable). Have a fix coming up, let me know if it works out for you.
from agera.
Still a seriously strange problem, some odd corner case of the java compiler I suppose :)
from agera.
I agree. And here is one thing I forgot to mention, a similar bug is reported to OpenJDK, which should be fixed with Java 9: https://bugs.openjdk.java.net/browse/JDK-7101822
And thank you for your fix. I tried with the latest source code and I could compile the code successfully. 👍
from agera.
Related Issues (20)
- Compilation problems HOT 1
- Crash when trying to remove not added updatable HOT 1
- Add the 1.2.0 release to the GitHub releases screen HOT 1
- Exception when Response is Empty HOT 4
- [Question] Usages of non main thread to register an Updatable to a BaseObservable? HOT 5
- Wish to support Kotlin language.
- crash bug HOT 3
- About IdentityMultimap query. HOT 3
- Is this library dead? HOT 2
- [question] Push Event on a high speed frequency, Pull Data will too busy to attend to all HOT 2
- Query HOT 3
- [Query]: About switch work-thread HOT 10
- Agera 是否支持线程并发再合并? HOT 1
- #44
- (gradle4.4.1, agera1.4.0) when I run proguard, I got these warnings:
- Could not find dependency "com.google.android.agera:agera:1.4.0" HOT 6
- Sample doesn't build, is this project dead? HOT 7
- Androidx支持
- Deploy the last artifact outside of jcenter HOT 1
- Security Policy violation Binary Artifacts HOT 41
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agera.