Skip to content

Treamz updates#2

Open
ljmatan wants to merge 8 commits into
ljmatan:mainfrom
Treamz:main
Open

Treamz updates#2
ljmatan wants to merge 8 commits into
ljmatan:mainfrom
Treamz:main

Conversation

@ljmatan
Copy link
Copy Markdown
Owner

@ljmatan ljmatan commented Jan 9, 2026

No description provided.

This change ensures that when a method in a base class is obfuscated,
all its overriding implementations in subclasses are renamed to the
same obfuscated name.

The previous implementation iterated through a flat list of method
declarations, generating a new random name for each, which resulted
in different names for a method and its overrides.

The new implementation groups method declarations by their semantic
element, generates a single obfuscated name for each group, and then
applies that name to all declarations and references within that group.
This maintains the semantic link between a method and its overrides,
ensuring they are obfuscated consistently.
This commit addresses two issues:
1.  **Constructor Renaming:** The obfuscator now correctly renames constructor declarations to match their enclosing class when the class itself is obfuscated. This fixes the 'constructor name must match enclosing class' error. This was achieved by adding  to  in  to ensure the class name part of the constructor declaration is treated as a reference to the class.
2.  **Ignore .gr.dart files:** Added a filter in  to ignore files ending with  during source collection. These are typically generated files and should not be obfuscated.
- Modified  to introduce a new  method in . This method filters declarations, ensuring only  types are added to the collection for obfuscation.
- Updated all  methods in , , and  to use  instead of directly adding to the collection.
- Corrected the initialization of  in  to use literal string names ('NoObfuscation', 'publicApi') for annotations, ensuring  correctly prevents obfuscation for annotated classes.
- Adjusted SDK constraints in  and  to  and downgraded  to  to resolve dependency conflicts with the current Dart SDK.
- Made Wrote 1/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/utils.dart iterations. Latest: ExampleUtility.
Wrote 2/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/main.dart iterations. Latest: ExampleUtility.
Wrote 3/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/main.dart iterations. Latest: SecretClass.
Wrote 4/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/main.dart iterations. Latest: SecretClass.
Wrote 5/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/api.dart iterations. Latest: ExampleAPi.
Wrote 6/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/api.dart iterations. Latest: ExampleAPi.
Wrote 7/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/api.dart iterations. Latest: ExampleAPi.
Wrote 8/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/src/private.dart iterations. Latest: ExamplePrivateClass.
Wrote 9/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/src/private.dart iterations. Latest: ExamplePrivateClass.
Wrote 10/10 file /Users/dmytro/Developer/obfuscator/out/copy/example/lib/src/private.dart iterations. Latest: ExamplePrivateClass. executable.
- Modified  to re-enable obfuscation for variables (fields) by including  types in the  method. Method obfuscation remains disabled.
- Added logic to  in  to exclude classes annotated with  from obfuscation, similar to  and  annotated classes.
This commit addresses a modification detected in lib/src/generator.dart by git status.
No functional changes were intended or made to this file during recent tasks.
The modification is likely due to automatic formatting or tooling during dependency updates.
Committing to clear the working directory status.
# Conflicts:
#	lib/src/config.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants