Skip to content
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

Drop support for Java 6 #3961

Closed
ejona86 opened this issue Jan 11, 2018 · 15 comments
Closed

Drop support for Java 6 #3961

ejona86 opened this issue Jan 11, 2018 · 15 comments
Milestone

Comments

@ejona86
Copy link
Member

ejona86 commented Jan 11, 2018

This would allow using (at least some) Java 7 language features and more of the Java 7 API. Android support for Java 7 has advanced. We need to figure out exactly what restrictions we'll need, but on the surface things seem far enough along to push forward with the drop of Java 6 support.

We'd still support the subset of Java 7 that is used by Android; we're not willing to reduce our API level support for this.

@ericgribkoff

@ejona86 ejona86 added this to the Next milestone Jan 11, 2018
@ejona86
Copy link
Member Author

ejona86 commented Jan 11, 2018

For anyone seeing this and panicking, "it's okay." We plan to be careful with this and check that any solutions will work well for our users. This is an eventual goal.

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jan 12, 2018 via email

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jan 12, 2018 via email

@ejona86
Copy link
Member Author

ejona86 commented Jan 12, 2018

@adriancole, Census at least was partially following suit from gRPC, so it's still useful to know that even if gRPC drops support it may be good for Census to be more conservative.

We do actually agree that there were few Java 7 language features that are transformative. So we've not pushed too hard. But we do want Java 8 language features, and Java 7 is a stepping stone for that.

Android has come along and is even supporting Java 8 features. Java 7 is not receiving public updates and Java 8/9 public updates will stop this year. Combined with the "one + three back" policy means we may find ourselves not easily able to support Java 6. Adding in Oracle's move to a 6 month release schedule forms a bit of a perfect storm. We could possibly post-process with retrolambda or similar, but EOL increases testing burden as well.

I'm sure we'll not be the only ones trying to figure things out, so some common approaches will probably surface. But the burden is increasing for unknown benefit. Even if we decide to continue supporting Java 6, we should have an idea of how much benefit it's providing and how to determine when to stop.

The solution here may be to just rely on maintenance to old release branches, so people stuck on an older JDK stop receiving features without being completely hung to dry. But even that will have complications, like dealing with bug fixes in Netty.

Stuff to figure out.

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jan 13, 2018 via email

@carl-mastrangelo
Copy link
Contributor

Adding to the Java7 wishlist: ThreadLocalRandom and ForkJoinPool, as well as setRemoveOnCancelPolicy

@ejona86
Copy link
Member Author

ejona86 commented Jan 25, 2018

I just realized that Guava 20 is the last version that uses Java 6 bytecode. We really need to be able to get to/past Guava 21, because that's when Guava stopped breaking non-@Beta APIs. Guava 21 itself is not feasible, since it requires Java 8. But Guava 22-Android supports Java 7.

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jan 25, 2018 via email

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jan 25, 2018 via email

@ejona86
Copy link
Member Author

ejona86 commented Jan 26, 2018

Yes, however we've got the OSGi+Java 9 module stuff that requires re-uniting grpc-context and grpc-core. We'll have the new API, but this does make migration all the more awkward. What a mess...

Maybe we split out grpc-api (io.grpc) from grpc-core (io.grpc.internal et al), and keep grpc-context+grpc-api Java 6-safe. But we do depend on Guava in io.grpc. Most of it is easy to avoid, except for BaseEncoding for base64. Maybe we move that part of Metadata to internal. Or maybe we accept the Guava dependency that simply won't be used at runtime (and so it could be safely downgraded). What a mess...

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jan 26, 2018 via email

@raphw
Copy link

raphw commented Jan 26, 2018

At the moment, the largest user groups are Java 6 and Java 8 users. Java 6 users are often in the enterprise building legacy apps and I assume that not many of those adopted gRPC. From that perspective, a direct update to Java 8 seems to make more sense than Java 7. But since it is mentioned that Android still relies on Java 7, this might be the right decission nevertheless. I thought that Android had adopted Java 8 for most features? Quick Google search basically confirmed that.

@xuwei-k
Copy link
Contributor

xuwei-k commented Jan 30, 2018

protocolbuffers/protobuf#4224 protobuf dropped Java 6 support

@dapengzhang0 dapengzhang0 added the gRPC 2.0 Issue requires breaking stable APIs label Feb 23, 2018
@ejona86 ejona86 removed the gRPC 2.0 Issue requires breaking stable APIs label Mar 21, 2018
@ejona86
Copy link
Member Author

ejona86 commented Jul 23, 2018

Android is not a limiting factor. We should be able to use Java 7 (and even 8) language features and still support Android API level 14. To manage runtime API availability there are Android profiles for animalsniffer. Not everything is supported for Java 8, but most of the useful things are. For example, that would allow us to have default interface methods. Java 8 would require our users to add some configuration to their builds, but they're probably already doing that. Note that the animal sniffer piece is really important to me; I don't want constant accidental regressions to android.

One notable detail: try-with-resources is not available in the "Java 7" setup in Android, but is with the "Java 8". To enable Java 8 (language features), our users would need:

android {
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

More details: http://tools.android.com/recent/androidstudio032released (Java 7). https://developer.android.com/studio/write/java8-support (Java 8)

We may want to encourage our users to use the Java 8 support so we can use try-with-resources. We'd still build with Java 7 bytecode. It'd help multiple parts of our code, mainly to manage suppressed exceptions. (Since older Android doesn't have suppressed exceptions, we couldn't require support for it. But "if supported, use it" is a fine approach.)

@ejona86
Copy link
Member Author

ejona86 commented Aug 3, 2018

For posterity, the email announcement: https://groups.google.com/d/msg/grpc-io/ajGrPStRS1I/KPlXLYmsAQAJ

ejona86 added a commit to ejona86/grpc-java that referenced this issue Aug 27, 2018
ejona86 added a commit to ejona86/grpc-java that referenced this issue Aug 27, 2018
Core and OkHttp are left with Java 6 for the moment. Once we resolve
their issues they could be bumped as well.

Updates grpc#3961
ejona86 added a commit that referenced this issue Aug 27, 2018
Core and OkHttp are left with Java 6 for the moment. Once we resolve
their issues they could be bumped as well.

Updates #3961
@ejona86 ejona86 modified the milestones: Next, 1.15 Oct 12, 2018
@ejona86 ejona86 closed this as completed Oct 12, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants