This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 236450 - Unknown property in JSF composite component implementation
Summary: Unknown property in JSF composite component implementation
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSF Editor (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Martin Fousek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-27 09:05 UTC by zmirc
Modified: 2013-11-22 15:41 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
see the warning left messages/icons (78.60 KB, image/jpeg)
2013-09-27 09:05 UTC, zmirc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zmirc 2013-09-27 09:05:02 UTC
Created attachment 140537 [details]
see the warning left messages/icons

Hi!

In JSF composite components, if receive an Object (with more fields) as a cc:attribute and I try to access its fields in cc:implementation, NetBeans says "unknown property".

I am aware that JSF doesn't actually know what kind of object I am going to set into my component's cc:attribut, but NetBeans shouldn't say "unknown property" because that's not true neither.
The property exists, but NB doesn't know the class, therefore it would be better if NB doesn't say anything.

It would be even better if NB detected what object is passed into that component's parameter, then it could offer autocompletion.
See the attached image for more insights.

NetBeans 7.4 RC 1
Thank you.
Comment 1 Vladimir Riha 2013-09-27 09:34:52 UTC
Can you use type attribute in your case? If so, the warning goes away and you get also code completion for the object, e.g.:

<cc:attribute name="item" required="true" type="org.test.ItemBean"/>
Comment 2 zmirc 2013-09-27 09:43:52 UTC
I'm receiving an entity (POJO) of com.pingushare.entity.p1.Trade in that component. Setting it as type="com.pingushare.entity.p1.Trade" doesn't seem to make any difference.

Moreover, there are some places where I receive different types of entities in the same component paramenter, so, even though this type worked, I couldn't specify a specific entity because I'm receiving more.

Interfaces might be useful in this case, but it doesn't make sense to start creating interfaces for all slightly common fields of some entities, when they're not actually so related nor necessary in Java code, just for the sake of JSF.
Comment 3 Vladimir Riha 2013-09-27 09:47:37 UTC
I see, thank you for trying.
Comment 4 Martin Fousek 2013-10-01 23:56:05 UTC
You are right, it can be annoying to see these false warnings. Ok, I fixed it in that way that if you will specify type of the attribute, properties will be checked whether they are valid or not. If you have no class attribute in the interface clause no warnings should appear. Thanks a lot for reporting.

Fixed in web-main #5d9f87134868.

Do you guys think that it should be candidate for the nb7.4 patch? I have unit tests around that functionality so the change should be safe.
Comment 5 zmirc 2013-10-02 06:46:47 UTC
Great!
Thank you also.
Please put it in 7.4, otherwise we'll wait too long until a new release.
It doesn't make sense to wait if you already have everything necessary.
Thanks again.
Comment 6 Vladimir Riha 2013-10-02 06:55:48 UTC
(In reply to Martin Fousek from comment #4)
> Do you guys think that it should be candidate for the nb7.4 patch? I have
> unit tests around that functionality so the change should be safe.

No objections from me :) Adding proper SW for 7.4patch. 

@zmirc: Unfortunately it is too late for 7.4 but it is now a patch candidate so you won't have to wait for new release, only for patch (there is no ETA yet though)
Comment 7 Vladimir Riha 2013-11-07 12:37:50 UTC
Reopening after offline discussion, hint need to follow type not class attribute for resolving attribute type. But with class it behaves as it described ;)
Comment 8 Martin Fousek 2013-11-07 13:04:45 UTC
(In reply to Vladimir Riha from comment #7)
> Reopening after offline discussion, hint need to follow type not class
> attribute for resolving attribute type. But with class it behaves as it
> described ;)

Thanks for catching that, Vlado!

Should be fixed in web-main #0357ce1d1da4.
Comment 9 Vladimir Riha 2013-11-08 11:14:39 UTC
Thank you, verified

Product Version: NetBeans IDE Dev (Build 201311080001)
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 10 Martin Fousek 2013-11-08 12:03:51 UTC
(In reply to Vladimir Riha from comment #9)
> Thank you, verified

That was fast, thanks!
Comment 11 Martin Fousek 2013-11-08 13:05:30 UTC
Transplanted into release74 as:

changeset:   275307:3f304b7cf8e5
branch:      release74
summary:     #236449 - Unknown property in JSF composite component implementation

changeset:   275308:142f694beb2b
branch:      release74
summary:     Long description update

changeset:   275309:432627e45495
branch:      release74
summary:     #236450 - Unknown property in JSF composite component implementation

changeset:   275310:0e99c69fa507
branch:      release74
summary:     Increased spec. version, long description update
Comment 12 Vladimir Riha 2013-11-22 15:41:12 UTC
verified in patch

Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 1
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)