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

use -source 7 or higher to enable diamond operator #2108

Closed
xpleaf opened this issue Apr 20, 2021 · 4 comments
Closed

use -source 7 or higher to enable diamond operator #2108

xpleaf opened this issue Apr 20, 2021 · 4 comments
Labels

Comments

@xpleaf
Copy link

xpleaf commented Apr 20, 2021

I just follow the tutorial from:
http://opentsdb.net/docs/build/html/installation.html

and run the command:

git clone git://github.com/OpenTSDB/opentsdb.git
cd opentsdb
./build.sh

But the following error was reported:

..................
ignore some output
..................

warning: [options] bootstrap class path not set in conjunction with -source 1.6
../src/core/SplitRollupQuery.java:451: error: diamond operator is not supported in -source 1.6
            TreeSet<byte[]> allGroups = new TreeSet<>(Bytes.MEMCMP);
                                                    ^
  (use -source 7 or higher to enable diamond operator)
../src/core/SplitRollupSpanGroup.java:14: error: diamond operator is not supported in -source 1.6
    private final List<SpanGroup> spanGroups = new ArrayList<>();
                                                             ^
  (use -source 7 or higher to enable diamond operator)
2 errors
1 warning
make[1]: *** [.javac-stamp] Error 1
make[1]: Leaving directory `/home/hadoop/soft/opentsdb/build'
make: *** [all] Error 2

I noticed that the -source 6 parameter was used during the execution of the Java command:

File "TokenMgrError.java" is being rebuilt.
File "ParseException.java" is being rebuilt.
File "Token.java" is being rebuilt.
File "SimpleCharStream.java" is being rebuilt.
Parser generated with 0 errors and 1 warnings.
PWD: /home/hadoop/soft/opentsdb/build
/usr/local/jdk1.8.0_112/bin/javac -Xlint -source 6 -encoding utf-8

The question is, how do I get rid of the -source option?

@ghost
Copy link

ghost commented Apr 22, 2021

I am having the same issue and to resolve I made a clean clone of the repository and modified the following:

diff --git a/Makefile.am b/Makefile.am
index 9bf563d3..7c378d85 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -513,7 +513,7 @@ package_dir := $(subst .,/,$(package))
 UNITTESTS := $(test_SRC:test/%.java=$(package_dir)/%.class)
 PLUGINTESTS := $(test_plugin_SRC:test/%.java=$(package_dir)/%.class)
 PLUGINSVCS := $(test_plugin_SVCS:%=-C $(srcdir)/test %)
-AM_JAVACFLAGS = -Xlint -source 6 -encoding utf-8
+AM_JAVACFLAGS = -Xlint -source 7 -encoding utf-8
 JVM_ARGS =
 classes := $(tsdb_SRC:src/%.java=$(package_dir)/%.class) \
         $(builddata_SRC:src/%.java=$(package_dir)/%.class)

But this leads to the next error:

Note: Some input files additionally use or override a deprecated API.
Note: ../test/stats/TestQueryStats.java uses unchecked or unsafe operations.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
10 errors
100 warnings
make: *** [Makefile:2022: .javac-unittests-stamp] Error 1

For the moment I am unable to build a new version. Did you have more chances to build OpenTSDB?

@manolama manolama added the bug label May 8, 2021
@manolama
Copy link
Member

manolama commented May 8, 2021

I have a patch to fix the diamond operators. This release will likely require Java 1.7 as the Jackson dependencies are now 1.7 as well.

Question: Is anyone still running 1.6 or 1.7 JVMs or has everyone migrated to 1.8 or 9+?

@vhirk
Copy link

vhirk commented Jun 29, 2021

Hi, did anybody solve this problem?

@manolama
Copy link
Member

manolama commented Jul 1, 2021

The diamonds were fixed in d33befe but I'll also make the change to support 1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants