okumin commented on code in PR #5809: URL: https://github.com/apache/hive/pull/5809#discussion_r2084400804
########## ql/src/java/org/apache/hadoop/hive/ql/exec/util/JavaVersionUtils.java: ########## @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.ql.exec.util; + +public class JavaVersionUtils { Review Comment: We should add a private constructor. https://sonarcloud.io/organizations/apache/rules?open=java%3AS1118&rule_key=java%3AS1118&tab=how_to_fix ########## hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonControllerJob.java: ########## @@ -167,6 +167,39 @@ public int run(String[] args) throws IOException, InterruptedException, ClassNot } return 0; } + private String addJavaOpensPackages(String amJavaOpts) { + final int JAVA_SPEC_VER = + Math.max(8, Integer.parseInt(System.getProperty("java.specification.version").split("\\.")[0])); + if (JAVA_SPEC_VER >= 9) { + return String.join(" ", amJavaOpts, getJavaAddOpenOptions()); + } else { + return amJavaOpts; + } + } + private String getJavaAddOpenOptions() { + return String.join(" ", + "-XX:+IgnoreUnrecognizedVMOptions", + "--add-opens=java.base/java.net=ALL-UNNAMED", + "--add-opens=java.base/java.util=ALL-UNNAMED", + "--add-opens=java.base/java.util.concurrent=ALL-UNNAMED", + "--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED", + "--add-opens=java.base/java.lang=ALL-UNNAMED", + "--add-opens=java.base/java.io=ALL-UNNAMED", + "--add-opens=java.base/java.lang.invoke=ALL-UNNAMED", + "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED", + "--add-opens=java.base/java.math=ALL-UNNAMED", + "--add-opens=java.base/java.nio=ALL-UNNAMED", + "--add-opens=java.base/java.text=ALL-UNNAMED", + "--add-opens=java.base/java.time=ALL-UNNAMED", + "--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED", + "--add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED", + "--add-opens=java.sql/java.sql=ALL-UNNAMED", + "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED", + "--add-opens=java.base/sun.nio.cs=ALL-UNNAMED", + "--add-opens=java.base/java.util.regex=ALL-UNNAMED" Review Comment: Just for your information, we are adding `java.base/java.security=ALL-UNNAMED` and `java.base/sun.security.provider=ALL-UNNAMED` as well in our JDK 11 environment. We don't have to add them unless we really need them, though. ########## hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonControllerJob.java: ########## @@ -167,6 +167,39 @@ public int run(String[] args) throws IOException, InterruptedException, ClassNot } return 0; } + private String addJavaOpensPackages(String amJavaOpts) { + final int JAVA_SPEC_VER = + Math.max(8, Integer.parseInt(System.getProperty("java.specification.version").split("\\.")[0])); + if (JAVA_SPEC_VER >= 9) { Review Comment: ```suggestion if (javaSpecVer >= 9) { ``` ########## hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonControllerJob.java: ########## @@ -167,6 +167,39 @@ public int run(String[] args) throws IOException, InterruptedException, ClassNot } return 0; } + private String addJavaOpensPackages(String amJavaOpts) { + final int JAVA_SPEC_VER = Review Comment: ```suggestion final int javaSpecVer = ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org