matthiasblaesing commented on a change in pull request #2491:
URL: https://github.com/apache/netbeans/pull/2491#discussion_r546428542
##########
File path:
enterprise/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/EjbJarProjectProperties.java
##########
@@ -323,11 +323,16 @@ private void init() {
PLATFORM_LIST_RENDERER =
PlatformUiSupport.createPlatformListCellRenderer();
SpecificationVersion minimalSourceLevel = null;
Profile profile =
Profile.fromPropertiesString(evaluator.getProperty(J2EE_PLATFORM));
- if (Profile.JAVA_EE_6_FULL.equals(profile)) {
+ LOGGER.log(Level.INFO, "init(326) profile: {0}", profile);
+ if (Profile.JAKARTA_EE_8_FULL.equals(profile)) {
+ minimalSourceLevel = new SpecificationVersion("1.8");
+ } else if (Profile.JAVA_EE_8_FULL.equals(profile)) {
+ minimalSourceLevel = new SpecificationVersion("1.8");
+ } else if (Profile.JAVA_EE_7_FULL.equals(profile)) {
+ minimalSourceLevel = new SpecificationVersion("1.7");
+ } else if (Profile.JAVA_EE_6_FULL.equals(profile)) {
minimalSourceLevel = new SpecificationVersion("1.6");
} else if (Profile.JAVA_EE_5.equals(profile)) {
- minimalSourceLevel = new SpecificationVersion("1.5");
- } else if (Profile.JAVA_EE_7_FULL.equals(profile)) {
minimalSourceLevel = new SpecificationVersion("1.7");
Review comment:
This looks strange - EE6 -> source level 1.6 and EE5 -> source level 1.7?
##########
File path:
enterprise/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/api/EjbJarProjectGenerator.java
##########
@@ -489,9 +503,7 @@ private static AntProjectHelper setupProject(FileObject
dirFO, String name,
SpecificationVersion v =
defaultPlatform.getSpecification().getVersion();
String sourceLevel = v.toString();
// #181215: JDK 6 should be the default source/binary format for Java
EE 6 projects
- if (sourceLevel.equals("1.7")) {
- sourceLevel = "1.6";
- }
+ // #181215: Not neccessary anymore because NetBeans should run on
minimum JDK 8
Review comment:
See comments about this above.
##########
File path:
enterprise/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/api/AppClientProjectGenerator.java
##########
@@ -544,9 +563,7 @@ private static AntProjectHelper setupProject(FileObject
dirFO, String name,
String sourceLevel = v.toString();
// #89131: these levels are not actually distinct from 1.5.
// #181215: JDK 6 should be the default source/binary format for Java
EE 6 projects
- if (sourceLevel.equals("1.7")) {
- sourceLevel = "1.6";
- }
+ // #181215: Not neccessary anymore because NetBeans should run on
minimum JDK 8
Review comment:
I read this as the target source level. If NetBeans runs on 8, it gets
even worse. The description implies, that a build project should be compatible
with Java 1.6, when generated for a JavaEE 6 client profile, this is ensures by
the original code, you move all projects to 8.
In the area where JavaEE is at home (large companies) I can imaginge setups
where indeed Java 1.6 ist the latest installed version.
##########
File path:
enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java
##########
@@ -81,10 +83,9 @@ public static FileObject createWebXml(Profile j2eeProfile,
boolean webXmlRequire
} else if (Profile.J2EE_13 == j2eeProfile) {
template = "web-2.3.xml"; //NOI18N
}
-
if (template == null)
return null;
-
+ Logger.getLogger(DDHelper.class.getName()).log(Level.INFO, "template:
{0}", template);
Review comment:
Should this really be logged on INFO level?
##########
File path:
enterprise/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/api/AppClientProjectGenerator.java
##########
@@ -780,15 +800,15 @@ private static void createManifest(FileObject dir, String
path) throws IOExcepti
FileObject manifest = FileUtil.createData(dir, path);
FileLock lock = manifest.lock();
try {
- OutputStream os = manifest.getOutputStream(lock);
- try {
- PrintWriter pw = new PrintWriter(os);
+ PrintWriter pw = null;
+ try (OutputStream os = manifest.getOutputStream(lock)) {
Review comment:
I would move the PrintWriter also into the resource block of the
try-with-resource construct. I don't see a reason to special case it here.
##########
File path:
enterprise/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarProjectGenerator.java
##########
@@ -111,8 +109,7 @@ private EarProjectGenerator(File prjDir, FileObject
prjDirFO, String name, Profi
this.j2eeProfile = j2eeProfile;
this.serverInstanceID = serverInstanceID;
// #181215: JDK 6 should be the default source/binary format for Java
EE 6 projects
- if (sourceLevel != null && (sourceLevel.equals("1.7")))
- sourceLevel = "1.6";
Review comment:
And source level again.
##########
File path:
enterprise/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarProjectGenerator.java
##########
@@ -600,16 +599,17 @@ public static void setPlatformSourceLevel(final
AntProjectHelper helper, final S
}
try {
projectDir.getFileSystem().runAtomicAction(new AtomicAction() {
+ @Override
public void run() throws IOException {
ProjectManager.mutex().writeAccess(new Runnable() {
+ @Override
public void run() {
try {
EditableProperties ep =
helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
// #89131: these levels are not actually
distinct from 1.5.
String srcLevel = sourceLevel;
// #181215: JDK 6 should be the default
source/binary format for Java EE 6 projects
- if (sourceLevel.equals("1.7"))
- srcLevel = "1.6";
+ // #181215: Not neccessary anymore because
NetBeans should run on minimum JDK 8
Review comment:
See my other comments about this.
##########
File path:
enterprise/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/api/AppClientProjectGenerator.java
##########
@@ -747,13 +770,10 @@ public void run() {
if (finalPlatformName == null) {
finalPlatformName =
PreferredProjectPlatform.getPreferredPlatform(JavaPlatform.getDefault().getSpecification().getName()).getDisplayName();
}
-
// #89131: these levels are not actually
distinct from 1.5.
// #181215: JDK 6 should be the default
source/binary format for Java EE 6 projects
+ // #181215: Not neccessary anymore because
NetBeans should run on minimum JDK 8
String srcLevel = sourceLevel;
- if (sourceLevel.equals("1.7")) {
- srcLevel = "1.6";
- }
Review comment:
See comment above - probably same situation.
##########
File path:
enterprise/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/ProjectEar.java
##########
@@ -885,7 +924,7 @@ public void artifactsUpdated(Iterable<Artifact> artifacts) {
try {
FileUtil.createData(destFile);
} catch (IOException ex) {
- LOGGER.log(Level.INFO, "Could not prepare data file",
ex);
+ LOGGER.log(Level.INFO, "Could not prepare data file
{0}", ex);
Review comment:
The parameter is not necessary. If an exception is present, it will be
logged with message, no need to for the placeholder.
##########
File path:
enterprise/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarProjectGenerator.java
##########
@@ -543,8 +543,7 @@ private AntProjectHelper setupProject() throws IOException {
srcLevel = v.toString();
// #89131: these levels are not actually distinct from 1.5.
// #181215: JDK 6 should be the default source/binary format for
Java EE 6 projects
- if (srcLevel.equals("1.7"))
- srcLevel = "1.6";
Review comment:
This is several places - I saw a source level defined in one of the
classes touched by this PR, why is that not used?
##########
File path:
enterprise/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/api/EjbJarProjectGenerator.java
##########
@@ -174,16 +176,26 @@ public Void run() throws Exception {
Exceptions.printStackTrace(ex.getException());
}
- // create ejb-jar.xml
+ // Create ejb-jar.xml just for J2EE (1.3 and 1.4)
Profile profile = createData.getJavaEEProfile();
- if (!Profile.JAVA_EE_5.equals(profile) &&
!Profile.JAVA_EE_6_FULL.equals(profile) &&
!Profile.JAVA_EE_6_WEB.equals(profile) &&
- !Profile.JAVA_EE_7_FULL.equals(profile) &&
!Profile.JAVA_EE_7_WEB.equals(profile)) {
- String resource =
"org-netbeans-modules-j2ee-ejbjarproject/ejb-jar-2.1.xml";
+ boolean isJ2EE = false;
+
+ if(profile.equals(Profile.J2EE_14) || profile.equals(Profile.J2EE_13))
{
+ isJ2EE = true;
+ }
+ if(isJ2EE) {
+ String resource;
+ if(profile.equals(Profile.J2EE_14))
+ resource =
"org-netbeans-modules-j2ee-ejbjarproject/ejb-jar-2.1.xml";
+ else
+ resource =
"org-netbeans-modules-j2ee-ejbjarproject/ejb-jar-2.0.xml";
Review comment:
Please add curly braces. In this case it costs one additional line and
makes it IMHO clearer what goes on.
##########
File path:
enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/common/RootInterface.java
##########
@@ -69,7 +70,7 @@
* MERGE_UNION is G1 U G2 <=> G1 + E2
* MERGE_INTERSECT is G1 n G2 <=> (G1 U G2) - E1 - E2
*</pre>
- * @param bean root of the bean graph that is merged with actual bean graph
+ * @param root root of the bean graph that is merged with actual bean graph
Review comment:
I think this should have been a delete - the word "bean" and the word
"root" in the first position of the documentation are superfluous.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists