JavaEngine sources.
This commit is contained in:
7
others/JavaEngine/.classpath
Normal file
7
others/JavaEngine/.classpath
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src" />
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
|
||||||
|
<classpathentry kind="lib" path="lib/ecj-4.4.jar" />
|
||||||
|
<classpathentry kind="output" path="bin" />
|
||||||
|
</classpath>
|
17
others/JavaEngine/.project
Normal file
17
others/JavaEngine/.project
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>JavaEngine</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
@@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
@@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
line.separator=\r\n
|
403
others/JavaEngine/.settings/org.eclipse.jdt.core.prefs
Normal file
403
others/JavaEngine/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,403 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.fieldSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.localPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.localSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
|
||||||
|
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=48
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_assignment=4
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=49
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=85
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=48
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
|
||||||
|
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_header=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_html=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_source_code=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.comment.line_length=300
|
||||||
|
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=1
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1
|
||||||
|
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
|
||||||
|
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
|
||||||
|
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
|
||||||
|
org.eclipse.jdt.core.formatter.indentation.size=4
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=300
|
||||||
|
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||||
|
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||||
|
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||||
|
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||||
|
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.tabulation.char=tab
|
||||||
|
org.eclipse.jdt.core.formatter.tabulation.size=4
|
||||||
|
org.eclipse.jdt.core.formatter.use_on_off_tags=true
|
||||||
|
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
72
others/JavaEngine/.settings/org.eclipse.jdt.ui.prefs
Normal file
72
others/JavaEngine/.settings/org.eclipse.jdt.ui.prefs
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
task-tags/enabled=true
|
||||||
|
task-tags/use-project-settings=true
|
12
others/JavaEngine/.settings/org.eclipse.wst.validation.prefs
Normal file
12
others/JavaEngine/.settings/org.eclipse.wst.validation.prefs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
DELEGATES_PREFERENCE=delegateValidatorList
|
||||||
|
USER_BUILD_PREFERENCE=enabledBuildValidatorList
|
||||||
|
USER_MANUAL_PREFERENCE=enabledManualValidatorList
|
||||||
|
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.400.v201204260100
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
override=true
|
||||||
|
suspend=false
|
||||||
|
vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01
|
||||||
|
vals/org.eclipse.wst.html.core.HTMLValidator/global=FF01
|
||||||
|
vals/org.eclipse.wst.html.ui.HTMLValidator/global=TF01
|
||||||
|
vals/org.eclipse.wst.xml.core.xml/groups=0107include05111contentType128org.eclipse.core.runtime.xmlT111contentType134org.eclipse.wst.xml.core.xmlsourceT111contentType134org.eclipse.wst.xml.core.xslsourceT111contentType134org.eclipse.jst.jsp.core.tldsourceT07fileext03xmlF0107exclude08113projectNature134org.eclipse.jst.j2ee.ejb.EJBNature113projectNature130org.eclipse.jst.j2ee.EARNature04file08.projectT0104file110.classpathT0104file110.settings/T0204file03binF0204file05buildF0204file09build.xmlF01
|
||||||
|
vf.version=3
|
114
others/JavaEngine/build.xml
Normal file
114
others/JavaEngine/build.xml
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="Java Engine" default="build" basedir=".">
|
||||||
|
<description>
|
||||||
|
This script will build the Java Engine lib.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
02111-1307, USA.
|
||||||
|
|
||||||
|
http://www.gnu.org/copyleft/gpl.html
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<property name="src" location="src" />
|
||||||
|
<property name="lib" location="lib" />
|
||||||
|
<property name="build" location="build" />
|
||||||
|
<property name="build.classes" location="${build}/classes" />
|
||||||
|
<property name="build.dist" location="${build}/dist" />
|
||||||
|
|
||||||
|
<path id="classpath">
|
||||||
|
<fileset dir="${lib}">
|
||||||
|
<include name="*.jar" />
|
||||||
|
</fileset>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<pathconvert property="manifest.libs" pathsep=" ">
|
||||||
|
<path refid="classpath" />
|
||||||
|
<mapper>
|
||||||
|
<chainedmapper>
|
||||||
|
<flattenmapper />
|
||||||
|
<globmapper from="*.jar" to="*.jar" />
|
||||||
|
</chainedmapper>
|
||||||
|
</mapper>
|
||||||
|
</pathconvert>
|
||||||
|
|
||||||
|
<target name="init" depends="clean,checkRequirements,getChangelogDateVersion" description="Create the output directories.">
|
||||||
|
<mkdir dir="${build}" />
|
||||||
|
<mkdir dir="${build.classes}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile" depends="init" description="Compile the source.">
|
||||||
|
<javac srcdir="${src}" classpathref="classpath" destdir="${build.classes}" compiler="javac1.8" createMissingPackageInfoClass="false" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="1.8" target="1.8" />
|
||||||
|
<copy todir="${build.classes}/META-INF/services">
|
||||||
|
<fileset dir="${src}/META-INF/services" />
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="jar" depends="compile" description="Create the jar file.">
|
||||||
|
<jar destfile="${build.dist}/java-engine-1.8.jar" level="9">
|
||||||
|
<fileset dir="${build.classes}" />
|
||||||
|
<manifest>
|
||||||
|
<attribute name="Built-By" value="${user.name}" />
|
||||||
|
<attribute name="Built-Date" value="${build.tstamp}" />
|
||||||
|
<attribute name="Class-Path" value="${manifest.libs}" />
|
||||||
|
<attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
|
||||||
|
</manifest>
|
||||||
|
</jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="dist" depends="jar">
|
||||||
|
<concat destfile="${build.dist}/java-engine_CHANGELOG.txt">${l2j.changelog}</concat>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="build" depends="dist" description="Generates a zip with the Java Engine.">
|
||||||
|
<zip destfile="${build}/java-engine.zip" basedir="${build.dist}" level="9" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean" description="Remove the output directories.">
|
||||||
|
<delete dir="${build}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="checkRequirements" description="Check Requirements">
|
||||||
|
<fail message="Ant 1.9.1 is required. But your version is ${ant.version} and if you are using Eclipse probably is outdated.">
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<antversion atleast="1.9.1" />
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
<available classname="java.util.stream.Stream" property="JDK8.present" />
|
||||||
|
<fail unless="JDK8.present" message="Java 1.8 is required. But your version is Java ${ant.java.version} and probably JDK is not installed." />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="getChangelogDateVersion" description="Get Changelog, Date, Version">
|
||||||
|
<exec dir="${basedir}" executable="svn" outputproperty="l2j.changelog">
|
||||||
|
<arg value="log" />
|
||||||
|
<arg value="--stop-on-copy" />
|
||||||
|
<arg value="--limit=50" />
|
||||||
|
</exec>
|
||||||
|
<tstamp>
|
||||||
|
<format property="build.tstamp" pattern="dd/MM/yyyy HH:mm" />
|
||||||
|
</tstamp>
|
||||||
|
<exec dir="${basedir}" executable="svnversion" outputproperty="l2j.version">
|
||||||
|
<arg value="-c" />
|
||||||
|
<redirector>
|
||||||
|
<outputfilterchain>
|
||||||
|
<tokenfilter>
|
||||||
|
<replaceregex pattern="[0-9]+\:" replace="" />
|
||||||
|
</tokenfilter>
|
||||||
|
</outputfilterchain>
|
||||||
|
</redirector>
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
</project>
|
BIN
others/JavaEngine/lib/ecj-4.4.jar
Normal file
BIN
others/JavaEngine/lib/ecj-4.4.jar
Normal file
Binary file not shown.
28
others/JavaEngine/lib/ecj_LICENSE.html
Normal file
28
others/JavaEngine/lib/ecj_LICENSE.html
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
|
||||||
|
<title>About</title>
|
||||||
|
</head>
|
||||||
|
<body lang="EN-US">
|
||||||
|
<h2>About This Content</h2>
|
||||||
|
|
||||||
|
<p>June 2, 2006</p>
|
||||||
|
<h3>License</h3>
|
||||||
|
|
||||||
|
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||||
|
indicated below, the Content is provided to you under the terms and conditions of the
|
||||||
|
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||||
|
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||||
|
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||||
|
|
||||||
|
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||||
|
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||||
|
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||||
|
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||||
|
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||||
|
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -0,0 +1 @@
|
|||||||
|
com.l2jserver.script.java.JavaScriptEngineFactory
|
@@ -0,0 +1,11 @@
|
|||||||
|
package com.l2jserver.script.java;
|
||||||
|
|
||||||
|
public class CompilationException extends Exception
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public CompilationException(String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met: Redistributions of source code
|
||||||
|
* must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution. Neither the name of the Sun Microsystems nor the names of
|
||||||
|
* is contributors may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
||||||
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package com.l2jserver.script.java;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.tools.Diagnostic;
|
||||||
|
import javax.tools.DiagnosticCollector;
|
||||||
|
import javax.tools.JavaCompiler.CompilationTask;
|
||||||
|
import javax.tools.JavaFileObject;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.internal.compiler.tool.EclipseCompiler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple interface to Java compiler using JSR 199 Compiler API.
|
||||||
|
* @author A. Sundararajan
|
||||||
|
*/
|
||||||
|
public class JavaCompiler
|
||||||
|
{
|
||||||
|
private final javax.tools.JavaCompiler tool;
|
||||||
|
|
||||||
|
public JavaCompiler()
|
||||||
|
{
|
||||||
|
tool = new EclipseCompiler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, byte[]> compile(String source, String fileName)
|
||||||
|
{
|
||||||
|
PrintWriter err = new PrintWriter(System.err);
|
||||||
|
return compile(source, fileName, err, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, byte[]> compile(String fileName, String source, Writer err)
|
||||||
|
{
|
||||||
|
return compile(fileName, source, err, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, byte[]> compile(String fileName, String source, Writer err, String sourcePath)
|
||||||
|
{
|
||||||
|
return compile(fileName, source, err, sourcePath, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* compile given String source and return bytecodes as a Map.
|
||||||
|
* @param fileName source fileName to be used for error messages etc.
|
||||||
|
* @param source Java source as String
|
||||||
|
* @param err error writer where diagnostic messages are written
|
||||||
|
* @param sourcePath location of additional .java source files
|
||||||
|
* @param classPath location of additional .class files
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, byte[]> compile(String fileName, String source, Writer err, String sourcePath, String classPath)
|
||||||
|
{
|
||||||
|
// to collect errors, warnings etc.
|
||||||
|
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
|
||||||
|
|
||||||
|
// create a new memory JavaFileManager
|
||||||
|
MemoryJavaFileManager manager = new MemoryJavaFileManager();
|
||||||
|
|
||||||
|
// prepare the compilation unit
|
||||||
|
List<JavaFileObject> compUnits = new ArrayList<>(1);
|
||||||
|
compUnits.add(MemoryJavaFileManager.makeStringSource(fileName, source));
|
||||||
|
|
||||||
|
// javac options
|
||||||
|
List<String> options = new ArrayList<>();
|
||||||
|
options.add("-warn:-enumSwitch");
|
||||||
|
options.add("-g");
|
||||||
|
options.add("-deprecation");
|
||||||
|
options.add("-1.8");
|
||||||
|
if (sourcePath != null)
|
||||||
|
{
|
||||||
|
options.add("-sourcepath");
|
||||||
|
options.add(sourcePath);
|
||||||
|
}
|
||||||
|
if (classPath != null)
|
||||||
|
{
|
||||||
|
options.add("-classpath");
|
||||||
|
options.add(classPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a compilation task
|
||||||
|
CompilationTask task = tool.getTask(err, manager, diagnostics, options, null, compUnits);
|
||||||
|
|
||||||
|
if (!task.call())
|
||||||
|
{
|
||||||
|
PrintWriter perr = new PrintWriter(err);
|
||||||
|
for (Diagnostic<?> diagnostic : diagnostics.getDiagnostics())
|
||||||
|
{
|
||||||
|
perr.println(diagnostic.getMessage(Locale.getDefault()));
|
||||||
|
}
|
||||||
|
perr.flush();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, byte[]> classBytes = manager.getClassBytes();
|
||||||
|
manager.close();
|
||||||
|
return classBytes;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,500 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met: Redistributions of source code
|
||||||
|
* must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution. Neither the name of the Sun Microsystems nor the names of
|
||||||
|
* is contributors may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
||||||
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package com.l2jserver.script.java;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.script.AbstractScriptEngine;
|
||||||
|
import javax.script.Bindings;
|
||||||
|
import javax.script.Compilable;
|
||||||
|
import javax.script.CompiledScript;
|
||||||
|
import javax.script.ScriptContext;
|
||||||
|
import javax.script.ScriptEngine;
|
||||||
|
import javax.script.ScriptEngineFactory;
|
||||||
|
import javax.script.ScriptException;
|
||||||
|
import javax.script.SimpleBindings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is script engine for Java programming language.
|
||||||
|
* @author A. Sundararajan
|
||||||
|
*/
|
||||||
|
public class JavaScriptEngine extends AbstractScriptEngine implements Compilable
|
||||||
|
{
|
||||||
|
// Java compiler
|
||||||
|
private final JavaCompiler compiler;
|
||||||
|
|
||||||
|
public JavaScriptEngine()
|
||||||
|
{
|
||||||
|
compiler = new JavaCompiler();
|
||||||
|
}
|
||||||
|
|
||||||
|
// my factory, may be null
|
||||||
|
private ScriptEngineFactory factory;
|
||||||
|
|
||||||
|
// my implementation for CompiledScript
|
||||||
|
private static class JavaCompiledScript extends CompiledScript implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private final transient JavaScriptEngine _engine;
|
||||||
|
private transient Class<?> _class;
|
||||||
|
private final Map<String, byte[]> _classBytes;
|
||||||
|
private final String _classPath;
|
||||||
|
|
||||||
|
JavaCompiledScript(JavaScriptEngine engine, Map<String, byte[]> classBytes, String classPath)
|
||||||
|
{
|
||||||
|
_engine = engine;
|
||||||
|
_classBytes = classBytes;
|
||||||
|
_classPath = classPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScriptEngine getEngine()
|
||||||
|
{
|
||||||
|
return _engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object eval(ScriptContext ctx) throws ScriptException
|
||||||
|
{
|
||||||
|
if (_class == null)
|
||||||
|
{
|
||||||
|
Map<String, byte[]> classBytesCopy = new HashMap<>();
|
||||||
|
classBytesCopy.putAll(_classBytes);
|
||||||
|
MemoryClassLoader loader = new MemoryClassLoader(classBytesCopy, _classPath, JavaScriptEngine.getParentLoader(ctx));
|
||||||
|
_class = JavaScriptEngine.parseMain(loader, ctx);
|
||||||
|
}
|
||||||
|
return JavaScriptEngine.evalClass(_class, ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompiledScript compile(String script) throws ScriptException
|
||||||
|
{
|
||||||
|
return compile(script, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompiledScript compile(Reader reader) throws ScriptException
|
||||||
|
{
|
||||||
|
return compile(readFully(reader));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object eval(String str, ScriptContext ctx) throws ScriptException
|
||||||
|
{
|
||||||
|
Class<?> clazz = parse(str, ctx);
|
||||||
|
return evalClass(clazz, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object eval(Reader reader, ScriptContext ctx) throws ScriptException
|
||||||
|
{
|
||||||
|
return eval(readFully(reader), ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScriptEngineFactory getFactory()
|
||||||
|
{
|
||||||
|
synchronized (this)
|
||||||
|
{
|
||||||
|
if (factory == null)
|
||||||
|
{
|
||||||
|
factory = new JavaScriptEngineFactory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Bindings createBindings()
|
||||||
|
{
|
||||||
|
return new SimpleBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFactory(ScriptEngineFactory factory)
|
||||||
|
{
|
||||||
|
this.factory = factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internals only below this point
|
||||||
|
|
||||||
|
private Class<?> parse(String str, ScriptContext ctx) throws ScriptException
|
||||||
|
{
|
||||||
|
String fileName = getFileName(ctx);
|
||||||
|
String sourcePath = getSourcePath(ctx);
|
||||||
|
String classPath = getClassPath(ctx);
|
||||||
|
|
||||||
|
Writer err = ctx.getErrorWriter();
|
||||||
|
if (err == null)
|
||||||
|
{
|
||||||
|
err = new StringWriter();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, byte[]> classBytes = compiler.compile(fileName, str, err, sourcePath, classPath);
|
||||||
|
|
||||||
|
if (classBytes == null)
|
||||||
|
{
|
||||||
|
if (err instanceof StringWriter)
|
||||||
|
{
|
||||||
|
throw new ScriptException(((StringWriter) err).toString());
|
||||||
|
}
|
||||||
|
throw new ScriptException("compilation failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a ClassLoader to load classes from MemoryJavaFileManager
|
||||||
|
MemoryClassLoader loader = new MemoryClassLoader(classBytes, classPath, getParentLoader(ctx));
|
||||||
|
return parseMain(loader, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Class<?> parseMain(MemoryClassLoader loader, ScriptContext ctx) throws ScriptException
|
||||||
|
{
|
||||||
|
String mainClassName = getMainClassName(ctx);
|
||||||
|
if (mainClassName != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class<?> clazz = loader.load(mainClassName);
|
||||||
|
Method mainMethod = findMainMethod(clazz);
|
||||||
|
if (mainMethod == null)
|
||||||
|
{
|
||||||
|
throw new ScriptException("no main method in " + mainClassName);
|
||||||
|
}
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
catch (ClassNotFoundException cnfe)
|
||||||
|
{
|
||||||
|
cnfe.printStackTrace();
|
||||||
|
throw new ScriptException(cnfe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no main class configured - load all compiled classes
|
||||||
|
Iterable<Class<?>> classes;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
classes = loader.loadAll();
|
||||||
|
}
|
||||||
|
catch (ClassNotFoundException exp)
|
||||||
|
{
|
||||||
|
throw new ScriptException(exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// search for class with main method
|
||||||
|
Class<?> c = findMainClass(classes);
|
||||||
|
if (c != null)
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if class with "main" method, then
|
||||||
|
// return first class
|
||||||
|
Iterator<Class<?>> itr = classes.iterator();
|
||||||
|
if (itr.hasNext())
|
||||||
|
{
|
||||||
|
return itr.next();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JavaCompiledScript compile(String str, ScriptContext ctx) throws ScriptException
|
||||||
|
{
|
||||||
|
String fileName = getFileName(ctx);
|
||||||
|
String sourcePath = getSourcePath(ctx);
|
||||||
|
String classPath = getClassPath(ctx);
|
||||||
|
|
||||||
|
Writer err = ctx.getErrorWriter();
|
||||||
|
if (err == null)
|
||||||
|
{
|
||||||
|
err = new StringWriter();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, byte[]> classBytes = compiler.compile(fileName, str, err, sourcePath, classPath);
|
||||||
|
if (classBytes == null)
|
||||||
|
{
|
||||||
|
if (err instanceof StringWriter)
|
||||||
|
{
|
||||||
|
throw new ScriptException(((StringWriter) err).toString());
|
||||||
|
}
|
||||||
|
throw new ScriptException("compilation failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new JavaCompiledScript(this, classBytes, classPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Class<?> findMainClass(Iterable<Class<?>> classes)
|
||||||
|
{
|
||||||
|
// find a public class with public static main method
|
||||||
|
for (Class<?> clazz : classes)
|
||||||
|
{
|
||||||
|
int modifiers = clazz.getModifiers();
|
||||||
|
if (Modifier.isPublic(modifiers))
|
||||||
|
{
|
||||||
|
Method mainMethod = findMainMethod(clazz);
|
||||||
|
if (mainMethod != null)
|
||||||
|
{
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// okay, try to find package private class that
|
||||||
|
// has public static main method
|
||||||
|
for (Class<?> clazz : classes)
|
||||||
|
{
|
||||||
|
Method mainMethod = findMainMethod(clazz);
|
||||||
|
if (mainMethod != null)
|
||||||
|
{
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no main class found!
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find public static void main(String[]) method, if any
|
||||||
|
private static Method findMainMethod(Class<?> clazz)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Method mainMethod = clazz.getMethod("main", new Class[]
|
||||||
|
{
|
||||||
|
String[].class
|
||||||
|
});
|
||||||
|
int modifiers = mainMethod.getModifiers();
|
||||||
|
if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers))
|
||||||
|
{
|
||||||
|
return mainMethod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NoSuchMethodException nsme)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find public static void setScriptContext(ScriptContext) method, if any
|
||||||
|
private static Method findSetScriptContextMethod(Class<?> clazz)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Method setCtxMethod = clazz.getMethod("setScriptContext", new Class[]
|
||||||
|
{
|
||||||
|
ScriptContext.class
|
||||||
|
});
|
||||||
|
int modifiers = setCtxMethod.getModifiers();
|
||||||
|
if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers))
|
||||||
|
{
|
||||||
|
return setCtxMethod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NoSuchMethodException nsme)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getFileName(ScriptContext ctx)
|
||||||
|
{
|
||||||
|
int scope = ctx.getAttributesScope("javax.script.filename");
|
||||||
|
if (scope != -1)
|
||||||
|
{
|
||||||
|
return ctx.getAttribute("javax.script.filename", scope).toString();
|
||||||
|
}
|
||||||
|
return "$unnamed.java";
|
||||||
|
}
|
||||||
|
|
||||||
|
// for certain variables, we look for System properties. This is
|
||||||
|
// the prefix used for such System properties
|
||||||
|
private static final String SYSPROP_PREFIX = "com.sun.script.java.";
|
||||||
|
|
||||||
|
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||||
|
private static final String ARGUMENTS = "arguments";
|
||||||
|
|
||||||
|
private static String[] getArguments(ScriptContext ctx)
|
||||||
|
{
|
||||||
|
int scope = ctx.getAttributesScope(ARGUMENTS);
|
||||||
|
if (scope != -1)
|
||||||
|
{
|
||||||
|
Object obj = ctx.getAttribute(ARGUMENTS, scope);
|
||||||
|
if (obj instanceof String[])
|
||||||
|
{
|
||||||
|
return (String[]) obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// return zero length array
|
||||||
|
return EMPTY_STRING_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String SOURCEPATH = "sourcepath";
|
||||||
|
|
||||||
|
private static String getSourcePath(ScriptContext ctx)
|
||||||
|
{
|
||||||
|
int scope = ctx.getAttributesScope(SOURCEPATH);
|
||||||
|
if (scope != -1)
|
||||||
|
{
|
||||||
|
return ctx.getAttribute(SOURCEPATH).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for "com.sun.script.java.sourcepath"
|
||||||
|
return System.getProperty(SYSPROP_PREFIX + SOURCEPATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String CLASSPATH = "classpath";
|
||||||
|
|
||||||
|
private static String getClassPath(ScriptContext ctx)
|
||||||
|
{
|
||||||
|
int scope = ctx.getAttributesScope(CLASSPATH);
|
||||||
|
if (scope != -1)
|
||||||
|
{
|
||||||
|
return ctx.getAttribute(CLASSPATH).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for "com.sun.script.java.classpath"
|
||||||
|
String res = System.getProperty(SYSPROP_PREFIX + CLASSPATH);
|
||||||
|
if (res == null)
|
||||||
|
{
|
||||||
|
res = System.getProperty("java.class.path");
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String MAINCLASS = "mainClass";
|
||||||
|
|
||||||
|
private static String getMainClassName(ScriptContext ctx)
|
||||||
|
{
|
||||||
|
int scope = ctx.getAttributesScope(MAINCLASS);
|
||||||
|
if (scope != -1)
|
||||||
|
{
|
||||||
|
return ctx.getAttribute(MAINCLASS).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for "com.sun.script.java.mainClass"
|
||||||
|
return System.getProperty("com.sun.script.java.mainClass");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String PARENTLOADER = "parentLoader";
|
||||||
|
|
||||||
|
protected static ClassLoader getParentLoader(ScriptContext ctx)
|
||||||
|
{
|
||||||
|
int scope = ctx.getAttributesScope(PARENTLOADER);
|
||||||
|
if (scope != -1)
|
||||||
|
{
|
||||||
|
Object loader = ctx.getAttribute(PARENTLOADER);
|
||||||
|
if (loader instanceof ClassLoader)
|
||||||
|
{
|
||||||
|
return (ClassLoader) loader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ClassLoader.getSystemClassLoader();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Object evalClass(Class<?> clazz, ScriptContext ctx) throws ScriptException
|
||||||
|
{
|
||||||
|
// JSR-223 requirement
|
||||||
|
ctx.setAttribute("context", ctx, 100);
|
||||||
|
if (clazz == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boolean isPublicClazz = Modifier.isPublic(clazz.getModifiers());
|
||||||
|
|
||||||
|
// find the setScriptContext method
|
||||||
|
Method setCtxMethod = findSetScriptContextMethod(clazz);
|
||||||
|
// call setScriptContext and pass current ctx variable
|
||||||
|
if (setCtxMethod != null)
|
||||||
|
{
|
||||||
|
if (!isPublicClazz)
|
||||||
|
{
|
||||||
|
// try to relax access
|
||||||
|
setCtxMethod.setAccessible(true);
|
||||||
|
}
|
||||||
|
setCtxMethod.invoke(null, new Object[]
|
||||||
|
{
|
||||||
|
ctx
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// find the main method
|
||||||
|
Method mainMethod = findMainMethod(clazz);
|
||||||
|
if (mainMethod != null)
|
||||||
|
{
|
||||||
|
if (!isPublicClazz)
|
||||||
|
{
|
||||||
|
// try to relax access
|
||||||
|
mainMethod.setAccessible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get "command line" args for the main method
|
||||||
|
String args[] = getArguments(ctx);
|
||||||
|
|
||||||
|
// call main method
|
||||||
|
mainMethod.invoke(null, new Object[]
|
||||||
|
{
|
||||||
|
args
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// return main class as eval's result
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
catch (Exception exp)
|
||||||
|
{
|
||||||
|
exp.printStackTrace();
|
||||||
|
throw new ScriptException(exp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// read a Reader fully and return the content as string
|
||||||
|
private String readFully(Reader reader) throws ScriptException
|
||||||
|
{
|
||||||
|
char[] arr = new char[8 * 1024]; // 8K at a time
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
int numChars;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while ((numChars = reader.read(arr, 0, arr.length)) > 0)
|
||||||
|
{
|
||||||
|
buf.append(arr, 0, numChars);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException exp)
|
||||||
|
{
|
||||||
|
throw new ScriptException(exp);
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,216 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met: Redistributions of source code
|
||||||
|
* must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution. Neither the name of the Sun Microsystems nor the names of
|
||||||
|
* is contributors may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
||||||
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package com.l2jserver.script.java;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.script.ScriptEngine;
|
||||||
|
import javax.script.ScriptEngineFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is script engine factory for "Java" script engine.
|
||||||
|
* @author A. Sundararajan
|
||||||
|
*/
|
||||||
|
public class JavaScriptEngineFactory implements ScriptEngineFactory
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public String getEngineName()
|
||||||
|
{
|
||||||
|
return "java";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEngineVersion()
|
||||||
|
{
|
||||||
|
return "1.8";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getExtensions()
|
||||||
|
{
|
||||||
|
return extensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguageName()
|
||||||
|
{
|
||||||
|
return "java";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguageVersion()
|
||||||
|
{
|
||||||
|
return "1.8";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMethodCallSyntax(String obj, String m, String... args)
|
||||||
|
{
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
buf.append(obj);
|
||||||
|
buf.append('.');
|
||||||
|
buf.append(m);
|
||||||
|
buf.append('(');
|
||||||
|
if (args.length != 0)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for (; i < (args.length - 1); i++)
|
||||||
|
{
|
||||||
|
buf.append(args[i] + ", ");
|
||||||
|
}
|
||||||
|
buf.append(args[i]);
|
||||||
|
}
|
||||||
|
buf.append(')');
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getMimeTypes()
|
||||||
|
{
|
||||||
|
return mimeTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getNames()
|
||||||
|
{
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOutputStatement(String toDisplay)
|
||||||
|
{
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
buf.append("System.out.print(\"");
|
||||||
|
int len = toDisplay.length();
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
char ch = toDisplay.charAt(i);
|
||||||
|
switch (ch)
|
||||||
|
{
|
||||||
|
case 34: // '"'
|
||||||
|
buf.append("\\\"");
|
||||||
|
break;
|
||||||
|
case 92: // '\\'
|
||||||
|
buf.append("\\\\");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
buf.append(ch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buf.append("\");");
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getParameter(String key)
|
||||||
|
{
|
||||||
|
if (key.equals("javax.script.engine"))
|
||||||
|
{
|
||||||
|
return getEngineName();
|
||||||
|
}
|
||||||
|
if (key.equals("javax.script.engine_version"))
|
||||||
|
{
|
||||||
|
return getEngineVersion();
|
||||||
|
}
|
||||||
|
if (key.equals("javax.script.name"))
|
||||||
|
{
|
||||||
|
return getEngineName();
|
||||||
|
}
|
||||||
|
if (key.equals("javax.script.language"))
|
||||||
|
{
|
||||||
|
return getLanguageName();
|
||||||
|
}
|
||||||
|
if (key.equals("javax.script.language_version"))
|
||||||
|
{
|
||||||
|
return getLanguageVersion();
|
||||||
|
}
|
||||||
|
if (key.equals("THREADING"))
|
||||||
|
{
|
||||||
|
return "MULTITHREADED";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProgram(String... statements)
|
||||||
|
{
|
||||||
|
// we generate a Main class with main method
|
||||||
|
// that contains all the given statements
|
||||||
|
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
buf.append("class ");
|
||||||
|
buf.append(getClassName());
|
||||||
|
buf.append(" {\n");
|
||||||
|
buf.append(" public static void main(String[] args) {\n");
|
||||||
|
if (statements.length != 0)
|
||||||
|
{
|
||||||
|
for (String statement : statements)
|
||||||
|
{
|
||||||
|
buf.append(" ");
|
||||||
|
buf.append(statement);
|
||||||
|
buf.append(";\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buf.append(" }\n");
|
||||||
|
buf.append("}\n");
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScriptEngine getScriptEngine()
|
||||||
|
{
|
||||||
|
JavaScriptEngine engine = new JavaScriptEngine();
|
||||||
|
engine.setFactory(this);
|
||||||
|
return engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
// used to generate a unique class name in getProgram
|
||||||
|
private String getClassName()
|
||||||
|
{
|
||||||
|
return "com_sun_script_java_Main$" + getNextClassNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static synchronized long getNextClassNumber()
|
||||||
|
{
|
||||||
|
return nextClassNum++;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long nextClassNum = 0L;
|
||||||
|
private static List<String> names;
|
||||||
|
private static List<String> extensions;
|
||||||
|
private static List<String> mimeTypes;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
names = new ArrayList<>(1);
|
||||||
|
names.add("java");
|
||||||
|
names = Collections.unmodifiableList(names);
|
||||||
|
extensions = names;
|
||||||
|
mimeTypes = new ArrayList<>(0);
|
||||||
|
mimeTypes = Collections.unmodifiableList(mimeTypes);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met: Redistributions of source code
|
||||||
|
* must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution. Neither the name of the Sun Microsystems nor the names of
|
||||||
|
* is contributors may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
||||||
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package com.l2jserver.script.java;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLClassLoader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassLoader that loads .class bytes from memory.
|
||||||
|
* @author A. Sundararajan
|
||||||
|
*/
|
||||||
|
public final class MemoryClassLoader extends URLClassLoader
|
||||||
|
{
|
||||||
|
private final Map<String, byte[]> classBytes;
|
||||||
|
|
||||||
|
public MemoryClassLoader(Map<String, byte[]> classBytes, String classPath, ClassLoader parent)
|
||||||
|
{
|
||||||
|
super(toURLs(classPath), parent);
|
||||||
|
this.classBytes = classBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MemoryClassLoader(Map<String, byte[]> classBytes, String classPath)
|
||||||
|
{
|
||||||
|
this(classBytes, classPath, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<?> load(String className) throws ClassNotFoundException
|
||||||
|
{
|
||||||
|
return loadClass(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iterable<Class<?>> loadAll() throws ClassNotFoundException
|
||||||
|
{
|
||||||
|
List<Class<?>> classes = new ArrayList<>(classBytes.size());
|
||||||
|
for (String name : classBytes.keySet())
|
||||||
|
{
|
||||||
|
classes.add(loadClass(name));
|
||||||
|
}
|
||||||
|
return classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?> findClass(String className) throws ClassNotFoundException
|
||||||
|
{
|
||||||
|
byte buf[] = classBytes.get(className);
|
||||||
|
if (buf != null)
|
||||||
|
{
|
||||||
|
// clear the bytes in map -- we don't need it anymore
|
||||||
|
classBytes.put(className, null);
|
||||||
|
return defineClass(className, buf, 0, buf.length);
|
||||||
|
}
|
||||||
|
return super.findClass(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static URL[] toURLs(String classPath)
|
||||||
|
{
|
||||||
|
if (classPath == null)
|
||||||
|
{
|
||||||
|
return new URL[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<URL> list = new ArrayList<>();
|
||||||
|
StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator);
|
||||||
|
while (st.hasMoreTokens())
|
||||||
|
{
|
||||||
|
String token = st.nextToken();
|
||||||
|
File file = new File(token);
|
||||||
|
if (file.exists())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
list.add(file.toURI().toURL());
|
||||||
|
}
|
||||||
|
catch (MalformedURLException mue)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
list.add(new URL(token));
|
||||||
|
}
|
||||||
|
catch (MalformedURLException mue)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
URL res[] = new URL[list.size()];
|
||||||
|
list.toArray(res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met: Redistributions of source code
|
||||||
|
* must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution. Neither the name of the Sun Microsystems nor the names of
|
||||||
|
* is contributors may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
||||||
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package com.l2jserver.script.java;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FilterOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.CharBuffer;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.tools.FileObject;
|
||||||
|
import javax.tools.JavaFileManager;
|
||||||
|
import javax.tools.JavaFileObject;
|
||||||
|
import javax.tools.JavaFileObject.Kind;
|
||||||
|
import javax.tools.SimpleJavaFileObject;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.internal.compiler.tool.EclipseFileManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JavaFileManager that keeps compiled .class bytes in memory.
|
||||||
|
* @author A. Sundararajan
|
||||||
|
*/
|
||||||
|
public final class MemoryJavaFileManager extends EclipseFileManager
|
||||||
|
{
|
||||||
|
private static final String EXT = ".java";
|
||||||
|
protected Map<String, byte[]> classBytes;
|
||||||
|
|
||||||
|
public MemoryJavaFileManager()
|
||||||
|
{
|
||||||
|
super(null, null);
|
||||||
|
classBytes = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, byte[]> getClassBytes()
|
||||||
|
{
|
||||||
|
return classBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
classBytes = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void flush()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A file object used to represent Java source coming from a string.
|
||||||
|
*/
|
||||||
|
private static class StringInputBuffer extends SimpleJavaFileObject
|
||||||
|
{
|
||||||
|
final String code;
|
||||||
|
|
||||||
|
StringInputBuffer(String name, String code)
|
||||||
|
{
|
||||||
|
super(toURI(name), Kind.SOURCE);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharBuffer getCharContent(boolean ignoreEncodingErrors)
|
||||||
|
{
|
||||||
|
return CharBuffer.wrap(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A file object that stores Java bytecode into the classBytes map.
|
||||||
|
*/
|
||||||
|
private class ClassOutputBuffer extends SimpleJavaFileObject
|
||||||
|
{
|
||||||
|
protected final String name;
|
||||||
|
|
||||||
|
ClassOutputBuffer(String name)
|
||||||
|
{
|
||||||
|
super(toURI(name), Kind.CLASS);
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OutputStream openOutputStream()
|
||||||
|
{
|
||||||
|
return new FilterOutputStream(new ByteArrayOutputStream())
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException
|
||||||
|
{
|
||||||
|
out.close();
|
||||||
|
ByteArrayOutputStream bos = (ByteArrayOutputStream) out;
|
||||||
|
classBytes.put(name, bos.toByteArray());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, String className, Kind kind, FileObject sibling) throws IOException
|
||||||
|
{
|
||||||
|
if (kind == Kind.CLASS)
|
||||||
|
{
|
||||||
|
return new ClassOutputBuffer(className.replace('/', '.'));
|
||||||
|
}
|
||||||
|
return super.getJavaFileForOutput(location, className, kind, sibling);
|
||||||
|
}
|
||||||
|
|
||||||
|
static JavaFileObject makeStringSource(String name, String code)
|
||||||
|
{
|
||||||
|
return new StringInputBuffer(name, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
static URI toURI(String name)
|
||||||
|
{
|
||||||
|
File file = new File(name);
|
||||||
|
if (file.exists())
|
||||||
|
{
|
||||||
|
return file.toURI();
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final StringBuilder newUri = new StringBuilder();
|
||||||
|
newUri.append("file:///");
|
||||||
|
newUri.append(name.replace('.', '/'));
|
||||||
|
if (name.endsWith(EXT))
|
||||||
|
{
|
||||||
|
newUri.replace(newUri.length() - EXT.length(), newUri.length(), EXT);
|
||||||
|
}
|
||||||
|
return URI.create(newUri.toString());
|
||||||
|
}
|
||||||
|
catch (Exception exp)
|
||||||
|
{
|
||||||
|
return URI.create("file:///com/sun/script/java/java_source");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
package com.l2jserver.script.java.tests;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
import javax.script.ScriptEngine;
|
||||||
|
import javax.script.ScriptEngineManager;
|
||||||
|
import javax.script.ScriptException;
|
||||||
|
|
||||||
|
public class Tests
|
||||||
|
{
|
||||||
|
public static void main(String args[]) throws ScriptException, IOException
|
||||||
|
{
|
||||||
|
ScriptEngineManager sem = new ScriptEngineManager();
|
||||||
|
ScriptEngine se = sem.getEngineByExtension("java");
|
||||||
|
se.getContext().setAttribute("classpath", "C:/TestCode", 100);
|
||||||
|
se.getContext().setAttribute("mainClass", "Test", 100);
|
||||||
|
se.getContext().setAttribute("javax.script.filename", "Test.java", 100);
|
||||||
|
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("TestCode/Test.java")));
|
||||||
|
se.eval(br);
|
||||||
|
System.err.flush();
|
||||||
|
System.out.flush();
|
||||||
|
System.err.println("PRESS ANY KEY AFTER EDITING FILE");
|
||||||
|
System.in.read();
|
||||||
|
br = new BufferedReader(new InputStreamReader(new FileInputStream("TestCode/Test.java")));
|
||||||
|
se.eval(br);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user