| Index: pkg/analysis_server/tool/spec/codegen_java.dart
|
| diff --git a/pkg/analysis_server/tool/spec/codegen_java.dart b/pkg/analysis_server/tool/spec/codegen_java.dart
|
| index a4bcbf9f0e75e387b896c38d824c57ec9860c1f4..45f812667d06051880ac65977af4a442ccc3f240 100644
|
| --- a/pkg/analysis_server/tool/spec/codegen_java.dart
|
| +++ b/pkg/analysis_server/tool/spec/codegen_java.dart
|
| @@ -55,6 +55,13 @@ class CodegenJavaVisitor extends HierarchicalApiVisitor with CodeGenerator {
|
| }
|
|
|
| /**
|
| + * Create a public field, using [callback] to create its contents.
|
| + */
|
| + void publicField(String fieldName, void callback()) {
|
| + _state.publicFields[fieldName] = collectCode(callback);
|
| + }
|
| +
|
| + /**
|
| * Create a private field, using [callback] to create its contents.
|
| */
|
| void privateField(String fieldName, void callback()) {
|
| @@ -96,22 +103,21 @@ class CodegenJavaVisitor extends HierarchicalApiVisitor with CodeGenerator {
|
| writeln('$header {');
|
| indent(() {
|
| // fields
|
| - List<String> allFields =
|
| - _valuesSortedByKey(_state.privateFields).toList();
|
| + List<String> allFields = _state.publicFields.values.toList();
|
| + allFields.addAll(_state.privateFields.values.toList());
|
| for (String field in allFields) {
|
| writeln();
|
| write(field);
|
| }
|
|
|
| // constructors
|
| - List<String> allConstructors =
|
| - _valuesSortedByKey(_state.constructors).toList();
|
| + List<String> allConstructors =_state.constructors.values.toList();
|
| for (String constructor in allConstructors) {
|
| writeln();
|
| write(constructor);
|
| }
|
|
|
| - // methods
|
| + // methods (ordered by method name)
|
| List<String> allMethods =
|
| _valuesSortedByKey(_state.publicMethods).toList();
|
| allMethods.addAll(_valuesSortedByKey(_state.privateMethods));
|
| @@ -119,6 +125,7 @@ class CodegenJavaVisitor extends HierarchicalApiVisitor with CodeGenerator {
|
| writeln();
|
| write(method);
|
| }
|
| + writeln();
|
| });
|
| writeln('}');
|
| } finally {
|
| @@ -229,6 +236,11 @@ class _CodegenJavaState {
|
| Map<String, String> privateMethods = <String, String>{};
|
|
|
| /**
|
| + * Temporary storage for public fields.
|
| + */
|
| + Map<String, String> publicFields = <String, String>{};
|
| +
|
| + /**
|
| * Temporary storage for private fields.
|
| */
|
| Map<String, String> privateFields = <String, String>{};
|
|
|