1 18 package org.apache.beehive.netui.compiler; 19 20 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; 21 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue; 22 import org.apache.beehive.netui.compiler.typesystem.declaration.Declaration; 23 24 25 public class RuntimeVersionChecker 26 implements JpfLanguageConstants 27 { 28 private String _runtimeVersion; 29 30 35 RuntimeVersionChecker() 36 { 37 _runtimeVersion = getHighVersion(); 38 } 39 40 82 83 private static String getHighVersion() 84 { 85 return new Integer ( Integer.MAX_VALUE ).toString(); 86 } 87 88 int getRuntimeVersion() 89 { 90 return Integer.parseInt( _runtimeVersion ); 91 } 92 93 public boolean checkRuntimeVersion( String requiredRuntimeVersion, AnnotationValue value, Diagnostics diags, 94 String errMsg, Object [] errMsgParams ) 95 { 96 if ( requiredRuntimeVersion != null ) 97 { 98 int runtimeVersion = getRuntimeVersion(); 99 100 if ( Integer.parseInt( requiredRuntimeVersion ) > runtimeVersion ) 101 { 102 diags.addError( value, errMsg, errMsgParams ); 103 return false; 104 } 105 } 106 107 return true; 108 } 109 110 public boolean checkRuntimeVersion( String requiredRuntimeVersion, Declaration element, Diagnostics diags, 111 String errMsg, Object [] errMsgParams ) 112 { 113 if ( requiredRuntimeVersion != null ) 114 { 115 int runtimeVersion = getRuntimeVersion(); 116 117 if ( Integer.parseInt( requiredRuntimeVersion ) > runtimeVersion ) 118 { 119 diags.addError( element, errMsg, errMsgParams ); 120 return false; 121 } 122 } 123 124 return true; 125 } 126 127 public boolean checkRuntimeVersion( String requiredRuntimeVersion, AnnotationInstance element, Diagnostics diags, 128 String errMsg, Object [] errMsgParams ) 129 { 130 if ( requiredRuntimeVersion != null ) 131 { 132 int runtimeVersion = getRuntimeVersion(); 133 134 if ( Integer.parseInt( requiredRuntimeVersion ) > runtimeVersion ) 135 { 136 diags.addError( element, errMsg, errMsgParams ); 137 return false; 138 } 139 } 140 141 return true; 142 } 143 } 144 | Popular Tags |