17

I have a component that gets an instance custom Apex Class as an attribute, ie:

<apex:component controller="ComponentController">
    <apex:attribute name="myAttr" assignTo="{!attr}" type="MyApexClass" />

</apex:component>

I also have this class:

public with sharing class MyApexClass{
    //lots of content
} 

But, since I updated Eclipse to the latest version (Summer '14, API version 31) I get this error when I try to save the component (or a page on which the component is used): Compilation error: Type is not visible: myapexclass.

I've already tried making MyApexClass global, doing so does solve the problem, however, this is for managed package so I really want to avoid making anything global that doesn't logically have to be, especially because it does work if I use Eclipse for version 30.

5
  • 2
    Same problem here :-( But it's not connected to Eclipse as I can reproduce it within the Developer Console. Aug 12 '14 at 14:24
  • 1
    Yeah, I got the same error on the developer console too. However, changing the pages or the component through the normal web interface does seem to work...
    – rael_kid
    Aug 15 '14 at 13:35
  • 1
    I can't find the reference to this now, but it is a bug in the tooling API. If you can change Eclipse to use the metadata API instead, then you can bypass this.
    – Mike Ginou
    Mar 24 '16 at 19:32
  • seems like this should be closed since Eclipse IDE has been retired
    – cropredy
    Oct 27 '19 at 14:43
  • I wouldn't mind at all if this question gets closed. :)
    – rael_kid
    Oct 28 '19 at 10:09
-1

Please Find the solution.

 <apex:attribute name="myAttr" assignTo="{!attr}" type="MyApexClass" />

In this line attribute type should be object then it would work fine you can take reference from my code;

aura component

<apex:component controller="ComponentController">

   <aura:attribute name="check" type="object" description="" access="public"/>
    <h1>"{!v.check.accountList[0].Name}"</h1>//showing data

</apex:component>

controller or helper

    var wrapperList=response.getReturnValue();
    c.set("v.check",wrapperList)

//apex class

public class Test {

public with sharing class wrapperList{

    @auraEnabled
        public List<Account> accountList;
       
    }

    @auraEnabled
    public static wrapperList containerofList(){
        wrapperList obj=new wrapperList();


      list<Account> aclist = new list<Account>();

        aclist = [Select id,name from account limit 20];

     obj.accountList=aclist;

     return obj;

    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.