Skip to content

Faulty Java class name when extending a class inside a file containing dots #761

@tsonevn

Description

@tsonevn

While extending a Java class in a file with a name containing dots (.) (e.g. items.component.ts), an anonymous class will be created with an invalid name, not respected by Java, which will lead to the below-mentioned error.
I am attaching sample project, where this behavior could be reproduced.

  • CLI: 3.0
  • Cross-platform modules:3.0
  • Runtime(s): 3.0

Error:

/Users/ntsonev/Desktop/git/issue4166/ngtest/platforms/android/src/main/java/com/tns/gen/android/telephony/PhoneStateListener_fitem_items_component_l12_c68__.java:3: error: '{' expected
public class PhoneStateListener_fitem_items.component_l12_c68__ extends android.telephony.PhoneStateListener implements com.tns.NativeScriptHashCodeProvider {
                                           ^
/Users/ntsonev/Desktop/git/issue4166/ngtest/platforms/android/src/main/java/com/tns/gen/android/telephony/PhoneStateListener_fitem_items_component_l12_c68__.java:4: error: <identifier> expected
        public PhoneStateListener_fitem_items.component_l12_c68__(){
                                                                 ^
2 errors
:compileF0DebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileF0DebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 13.861 secs
Multiple errors were thrown:
Command ./gradlew failed with exit code 1

Archive.zip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions