Git Product home page Git Product logo

Comments (6)

hkurokawa avatar hkurokawa commented on May 8, 2024

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.

 avatar commented on May 8, 2024

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.

hkurokawa avatar hkurokawa commented on May 8, 2024

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:

  1. Reorder the import statements
  2. Pull up the nested static class
  3. Delete the static import statements
  4. Leave it (some Linux users might not be able to compile the code) until Java 9 comes to Gradle

Any idea?

from agera.

 avatar commented on May 8, 2024

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.

 avatar commented on May 8, 2024

Still a seriously strange problem, some odd corner case of the java compiler I suppose :)

from agera.

hkurokawa avatar hkurokawa commented on May 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.