Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Warning: Possible deprecated use of set on a Java object with an HG Property

Subject: Warning: Possible deprecated use of set on a Java object with an HG Property

From: Dennis B.

Date: 17 Nov, 2011 07:59:10

Message: 1 of 6

Hi Guys,

I got a Problem since Matlab Version 2011a:

Warning: Possible deprecated use of set on a Java object with an HG Property 'UserData'.
> In sc_gdlconfigdlggui>i_create_gcdconfig at 253
  In sc_gdlconfigdlggui at 50
  In sc_gdlconfigdlg at 69
  In sc_maindlggui>mdconfigcriteria_callback at 2664
  In sc_maindlggui at 135

The problematic command is: set(Table_ja, 'UserData', 'Rule_st');

Anyone an idea?

My Matlab-Version:
-------------------------------------------------------------------------------------
MATLAB Version 7.12.0.635 (R2011a)
MATLAB License Number: 490273
Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 3)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
-------------------------------------------------------------------------------------

Subject: Warning: Possible deprecated use of set on a Java object with an HG Property

From: Steven_Lord

Date: 17 Nov, 2011 14:26:40

Message: 2 of 6



"Dennis B." <testhest@west.de> wrote in message
news:ja2ese$a4r$1@newscl01ah.mathworks.com...
> Hi Guys,
>
> I got a Problem since Matlab Version 2011a:
>
> Warning: Possible deprecated use of set on a Java object with an HG
> Property 'UserData'.
>> In sc_gdlconfigdlggui>i_create_gcdconfig at 253
> In sc_gdlconfigdlggui at 50
> In sc_gdlconfigdlg at 69
> In sc_maindlggui>mdconfigcriteria_callback at 2664
> In sc_maindlggui at 135
>
> The problematic command is: set(Table_ja, 'UserData', 'Rule_st');
>
> Anyone an idea?

http://www.mathworks.com/help/techdoc/rn/broifyr-1.html#brrxpv8-1

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Warning: Possible deprecated use of set on a Java object with an HG Property

From: Yair Altman

Date: 17 Nov, 2011 15:27:30

Message: 3 of 6

"Dennis B." wrote in message <ja2ese$a4r$1@newscl01ah.mathworks.com>...
> Hi Guys,
>
> I got a Problem since Matlab Version 2011a:
>
> Warning: Possible deprecated use of set on a Java object with an HG Property 'UserData'.
> > In sc_gdlconfigdlggui>i_create_gcdconfig at 253
> In sc_gdlconfigdlggui at 50
> In sc_gdlconfigdlg at 69
> In sc_maindlggui>mdconfigcriteria_callback at 2664
> In sc_maindlggui at 135
>
> The problematic command is: set(Table_ja, 'UserData', 'Rule_st');
>
> Anyone an idea?
>
> My Matlab-Version:
> -------------------------------------------------------------------------------------
> MATLAB Version 7.12.0.635 (R2011a)
> MATLAB License Number: 490273
> Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 3)
> Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
> -------------------------------------------------------------------------------------


Usually it is better to use the internal setter/getter methods of Java components. So, instead of:
    set(javaObj, 'Property',value)

You would use this:
   javaObj.setProperty(value)

However, since UserData is an internal Matlab object that does not have a corresponding setter/getter method, you can use this instead:

   setappdata(javaObj,'UserData',value);
   value = getappdata(javaObj,'UserData');

Yair Altman
http://UndocumentedMatlab.com

Subject: Warning: Possible deprecated use of set on a Java object with an HG Property

From: Dennis B.

Date: 23 Nov, 2011 12:52:08

Message: 4 of 6

> ...
> setappdata(javaObj,'UserData',value);
> value = getappdata(javaObj,'UserData');
>
> Yair Altman
> http://UndocumentedMatlab.com

Thx for your help and iam looking forward to your Matlab-Java Book :-)

Subject: Warning: Possible deprecated use of set on a Java object with an HG Property

From: Karl

Date: 10 Jul, 2014 19:49:16

Message: 5 of 6

I have a legacy script from a vendor that is p-coded - so it cannot be changed.

It generates this same deprecation warning in 2013b, but now completely fails in 2014a.

Is there a work-around to this issue? It is certainly caused by changes in the Matlab set/get call sequence for java objects. You can duplicate the error with the following commands:

strObj = javaObject('java.lang.String','hello'); %create a java object
get(strObj,'UserData'); %try to get the UserData
strObj.get('Userdata'); %another attempt to get the Userdata

These work (with warnings) in 2013b, but fail in 2014a.

Subject: Warning: Possible deprecated use of set on a Java object with an HG Property

From: Yair Altman

Date: 10 Jul, 2014 20:38:11

Message: 6 of 6

"Karl " <kschrad@sandia.gov> wrote in message <lpmqns$mdr$1@newscl01ah.mathworks.com>...
> I have a legacy script from a vendor that is p-coded - so it cannot be changed.
>
> It generates this same deprecation warning in 2013b, but now completely fails in 2014a.
>
> Is there a work-around to this issue? It is certainly caused by changes in the Matlab set/get call sequence for java objects. You can duplicate the error with the following commands:
[snip]


You need to go back to your vendor and ask them to change the code, or keep using Matlab 13b.

Yair Altman
http://UndocumentedMatlab.com
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us