Skip to content

Commit

Permalink
Set -source 8 -target 8 in the open-source build, and remove Java8U…
Browse files Browse the repository at this point in the history
…sage.

This is largely a rollback of the original Java8Usage change, but I've modified it in a few ways:

- I set `-source 8 -target 8` in the backport.
- I kept the code to make includes/excludes fully work with maven-compiler-plugin, since that could save us some confusion down the line.
- I incorporated a rollback of the changes to Preconditions from CL 361700569, in which I moved the warning from MoreObjects to Preconditions.
- I added errors to our internal release scripts so that we don't accidentally make a release that drops Java 7 support before we're ready.

Fixes #5269

PiperOrigin-RevId: 364405695
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Mar 23, 2021
1 parent 9dfb111 commit d7058a4
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 202 deletions.
36 changes: 0 additions & 36 deletions android/guava/pom.xml
Expand Up @@ -90,42 +90,6 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<!--
The execution named default-compile happens first, regardless
of the order of the executions in the source file. So, because
Java8Usage is a dependency of the main sources, we need to call
its compilation "default-compile," even though it's the special
case.
-->
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<includes>
<include>**/Java8Usage.java</include>
</includes>
<!-- -source 8 -target 8 is a no-op in the mainline but matters in the backport. -->
<source>8</source>
<target>8</target>
</configuration>
</execution>
<execution>
<id>main-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>**/Java8Usage.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
Expand Down
45 changes: 0 additions & 45 deletions android/guava/src/com/google/common/base/Java8Usage.java

This file was deleted.

19 changes: 0 additions & 19 deletions android/guava/src/com/google/common/base/Preconditions.java
Expand Up @@ -15,11 +15,9 @@
package com.google.common.base;

import static com.google.common.base.Strings.lenientFormat;
import static java.util.logging.Level.WARNING;

import com.google.common.annotations.GwtCompatible;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.logging.Logger;
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
import org.checkerframework.checker.nullness.compatqual.NullableDecl;

Expand Down Expand Up @@ -1490,21 +1488,4 @@ private static String badPositionIndexes(int start, int end, int size) {
// end < start
return lenientFormat("end index (%s) must not be less than start index (%s)", end, start);
}

static {
try {
Java8Usage.performCheck();
} catch (Throwable underlying) {
Exception toLog =
new Exception(
"Guava will drop support for Java 7 in 2021. Please let us know if this will cause"
+ " you problems: https://github.com/google/guava/issues/5269",
underlying);
Logger.getLogger(Preconditions.class.getName())
.log(
WARNING,
"Java 7 compatibility warning: See https://github.com/google/guava/issues/5269",
toLog);
}
}
}
4 changes: 2 additions & 2 deletions android/pom.xml
Expand Up @@ -132,8 +132,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<!--
Make includes/excludes fully work:
Expand Down
36 changes: 0 additions & 36 deletions guava/pom.xml
Expand Up @@ -90,42 +90,6 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<!--
The execution named default-compile happens first, regardless
of the order of the executions in the source file. So, because
Java8Usage is a dependency of the main sources, we need to call
its compilation "default-compile," even though it's the special
case.
-->
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<includes>
<include>**/Java8Usage.java</include>
</includes>
<!-- -source 8 -target 8 is a no-op in the mainline but matters in the backport. -->
<source>8</source>
<target>8</target>
</configuration>
</execution>
<execution>
<id>main-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>**/Java8Usage.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
Expand Down
45 changes: 0 additions & 45 deletions guava/src/com/google/common/base/Java8Usage.java

This file was deleted.

19 changes: 0 additions & 19 deletions guava/src/com/google/common/base/Preconditions.java
Expand Up @@ -15,11 +15,9 @@
package com.google.common.base;

import static com.google.common.base.Strings.lenientFormat;
import static java.util.logging.Level.WARNING;

import com.google.common.annotations.GwtCompatible;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.logging.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

Expand Down Expand Up @@ -1433,21 +1431,4 @@ private static String badPositionIndexes(int start, int end, int size) {
// end < start
return lenientFormat("end index (%s) must not be less than start index (%s)", end, start);
}

static {
try {
Java8Usage.performCheck();
} catch (Throwable underlying) {
Exception toLog =
new Exception(
"Guava will drop support for Java 7 in 2021. Please let us know if this will cause"
+ " you problems: https://github.com/google/guava/issues/5269",
underlying);
Logger.getLogger(Preconditions.class.getName())
.log(
WARNING,
"Java 7 compatibility warning: See https://github.com/google/guava/issues/5269",
toLog);
}
}
}

0 comments on commit d7058a4

Please sign in to comment.