Swing Problems Resulting from yGuard's Obfuscation Levels

Troubleshooting

Summary

Using yGuard's highest level of obfuscation can lead to problems with Java Swing.

This article was written for an older version. It is only online as a reference for customers using this old version. The information it contains is probably out of date.

The latest information can be found in the yFiles documentation

Description

The yGuard obfuscation process can be invoked with different settings for the 'naming-scheme' property. Using 'best', i.e., yGuard's highest level of name obfuscation, as the value for this property can generate very long names. In some cases, e.g., when such a long name replaces the name of a JFrame descendant, Java Swing crashes.

To avoid this problem, you can use yGuard's mapping feature to exclude certain classes from the obfuscation process, and give them predefined names instead.

<map>
  <class name="com.yourcompany.yourapp.yourpackage.YourFrame" map="SillyNewNameForYourFrame"/>
</map>

Note that the package names might have to be fixed, too.

<package name="com" map="com"/>
<package name="com.yourcompany" map="mycompany"/>
<package name="com.yourcompany.yourapplication" map="myapplication"/>
<package name="com.yourcompany.yourapplication.yourpackage" map="dont/look/into/this/package"/>

Categories this article belongs to:
yGuard
Applies to:
yGuard: 1.3, 1.5
Keywords:
Swing - JFrame - obfuscation - level