mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java: compiler compliance option encapsulated
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -749,18 +749,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
|
||||
private static String getLanguageLevel(JpsModule module) {
|
||||
final LanguageLevel level = JpsJavaExtensionService.getInstance().getLanguageLevel(module);
|
||||
if (level != null) {
|
||||
switch (level) {
|
||||
case JDK_1_3: return "1.3";
|
||||
case JDK_1_4: return "1.4";
|
||||
case JDK_1_5: return "1.5";
|
||||
case JDK_1_6: return "1.6";
|
||||
case JDK_1_7: return "1.7";
|
||||
case JDK_1_8: return "8";
|
||||
case JDK_1_9: return "9";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return level != null ? level.getComplianceOption() : null;
|
||||
}
|
||||
|
||||
private static boolean isEncodingSet(List<String> options) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,9 +15,26 @@
|
||||
*/
|
||||
package org.jetbrains.jps.model.java;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public enum LanguageLevel {
|
||||
JDK_1_3, JDK_1_4, JDK_1_5, JDK_1_6, JDK_1_7, JDK_1_8, JDK_1_9
|
||||
JDK_1_3("1.3"), JDK_1_4("1.4"), JDK_1_5("1.5"), JDK_1_6("1.6"), JDK_1_7("1.7"), JDK_1_8("1.8"), JDK_1_9("1.9");
|
||||
|
||||
private final String myComplianceOption;
|
||||
|
||||
LanguageLevel(String complianceOption) {
|
||||
myComplianceOption = complianceOption;
|
||||
}
|
||||
|
||||
/**
|
||||
* String representation of the level, suitable to pass as a value of compiler's "-source" and "-target" options.
|
||||
* Should work for Javac and ECJ (including ECJ-based) compilers.
|
||||
*/
|
||||
@NotNull
|
||||
public String getComplianceOption() {
|
||||
return myComplianceOption;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user