Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8047805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:13:13+00:00 2026-06-05T06:13:13+00:00

I’m using GWT. When it is compiling the Java code to Javascript code, sometimes

  • 0

I’m using GWT.

When it is compiling the Java code to Javascript code, sometimes it changes some of the members’ names.
for example:
private int height;
becomes in the JS:
height_0;

Example:


public class TestClass
{

    private int a;

public TestClass()
{
    a = 0;
}

public TestClass(int a)
{
    this.a = a;
}

public int getMember()
{
    return a;
}

public void advance()
{
    a++;
}

}

Will result in output like so:

function TestClass_0(){

 this.a_0 = 0;

}



function TestClass_1(a){

 this.a_0 = a;

}



function TestClass(){

}



_ = TestClass_1.prototype = TestClass_0.prototype = TestClass.prototype = new Object_0;

_.advance_0 = function advance(){

++this.a_0;

}

;

_.getClass$ = function getClass_1(){

return Lcom_autodesk_autocadws_gwt_platform_testExporter_TestClass_2_classLit;

}

;

_.getMember_0 = function getMember(){

return this.a_0;

}

;

_.a_0 = 0;

}

The name of the member a was changed to a_0. In some cases, when using web workers, the code will be compiled differently on the web worker script, and the member’s name will not be changed (or will be cjanged to a_1, for example).
My problem with that is when I transfer objects in messages to web workers. When coding the web worker side in Java, I’m expecting to access the member a, and not a_0. Using getters does not solve the issue, since they are simply replaced with direct access when compiled to JS.

My question:
Why are these naming changes occur? In which cases? Is it possible to avoid them?

Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:13:14+00:00Added an answer on June 5, 2026 at 6:13 am

    In most cases, the fields will actually be renamed to something lik a, b, etc. What you’re seeing here is due to compiling with -style PRETTY which does not obfuscate the code.

    The reason GWT obfuscates the code is to make it smaller.

    If you need to pass objects to the outside world, you have to serialize them (or map them to JavaScript objects) to a stable structure.

    The easiest way to do it is to use a JavaScriptObject. You can also have a look at gwt-exporter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.