| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5ac390c commit 1caae7f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7020,12 +7020,10 @@ public void optionChanged(OptionEvent<Integer> oce) { | |||
| 7020 | 7020 | case OptionConstants.INTERMEDIATE_LEVEL: | |
| 7021 | 7021 | case OptionConstants.FUNCTIONAL_JAVA_LEVEL: { | |
| 7022 | 7022 | rbFunctionalMenuItem.setSelected(true); | |
| 7023 | - System.out.println("rbFunctionalMenuItem.setSelected(true);"); | ||
| 7024 | 7023 | break; | |
| 7025 | 7024 | } | |
| 7026 | 7025 | default: { | |
| 7027 | 7026 | rbFullJavaMenuItem.setSelected(true); | |
| 7028 | - System.out.println("rbFullJavaMenuItem.setSelected(true);"); | ||
| 7029 | 7027 | break; | |
| 7030 | 7028 | } | |
| 7031 | 7029 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -996,6 +996,29 @@ public Expression cast(final Type target, final Expression e) throws Unsupported | |||
| 996 | 996 | try { | |
| 997 | 997 | Expression result = makePrimitive(e); | |
| 998 | 998 | Type source = NodeProperties.getType(result); | |
| 999 | + | ||
| 1000 | + // type check valid conversions, see ExpressionEvaluator.convert | ||
| 1001 | + if (target.equals(BOOLEAN)) { | ||
| 1002 | + if (!source.equals(BOOLEAN)) { throw new UnsupportedConversionException(); } | ||
| 1003 | + } | ||
| 1004 | + else if (target.equals(CHAR) || | ||
| 1005 | + target.equals(BYTE) || | ||
| 1006 | + target.equals(SHORT) || | ||
| 1007 | + target.equals(INT) || | ||
| 1008 | + target.equals(LONG) || | ||
| 1009 | + target.equals(FLOAT) || | ||
| 1010 | + target.equals(DOUBLE)) { | ||
| 1011 | + if ((!source.equals(CHAR)) && | ||
| 1012 | + (!source.equals(BYTE)) && | ||
| 1013 | + (!source.equals(DOUBLE)) && | ||
| 1014 | + (!source.equals(FLOAT)) && | ||
| 1015 | + (!source.equals(INT)) && | ||
| 1016 | + (!source.equals(LONG)) && | ||
| 1017 | + (!source.equals(SHORT))) { throw new UnsupportedConversionException(); } | ||
| 1018 | + } | ||
| 1019 | + else { throw new IllegalArgumentException(); } | ||
| 1020 | + // end type check valid conversions | ||
| 1021 | + | ||
| 999 | 1022 | if (!isEqual(target, source)) { NodeProperties.setConvertedType(result, erasedClass(target)); } | |
| 1000 | 1023 | return result; | |
| 1001 | 1024 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments