function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Neal LightfeldtNeal Lightfeldt 

Can't comment out Apex Class

I am adding "*/" at line 141 just above the last two brackets and I get this error: "Error: Compile Error: Expecting '}' but was: '*' at line 141 column 9"

Here's the code:

/*
*   Crane Barksdale Sandbox 
*   Created : 8-NOV-2012  
*   
*
*/
public with sharing class CallPlanner_detailcontroller 
{
 
 /*
    public string mutualpyramid{get;set;}
    public string customer{get;set;}
    public List<Event>lstEvent{get;set;}
    public boolean isEvent{get;set;}
    public final Call_Planner_2__c cplan;

    public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
    {
        
        mutualpyramid = '';
        customer= '';        
        customer = system.label.Customer_Needs; // image Link
        mutualpyramid = system.label.Mutual_Pyramid; // image Link
        isEvent = false;
        lstEvent = new List<Event>();
        
        try
        {
            //Get related events for this Call planner
            integer iCount = [  select count() 
                                from event 
                                where whatid = :ctlr.getId()
                             ];
    
    
    
            if (iCount != 0)
            {
                isEvent = true;
            }
            else 
            {
                this.cplan = (Call_Planner_2__c)ctlr.getRecord();
                if (cplan.event__c == '' || cplan.event__c == null) 
                {
                    isEvent = false;
                } 
                else 
                {
                    lstEvent = [    select id 
                                    from event 
                                    WHERE Id = :cplan.event__c
                                ];
                                
                    if (!lstEvent.isEmpty()) 
                    {
                        isEvent = true;
                    } 
                    else 
                    {
                        isEvent = false;
                    }
                }
            }
        }
        catch(Exception ex)
        {
            System.Debug(ex);
        }
    }

/**************************
Test Method
**************************/

static testMethod void myUnitTest1() {
        
        
        
        //creating Account
        Account objAcc = new Account();
        objAcc.Name='test';
        
        //objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
        //objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
        insert objAcc;
        
        //Creating Contact
        Contact objcon= new Contact();
        objcon.AccountId = objAcc.id;
        objcon.LastName='test';
        objcon.FirstName='test';
        //objcon.Business_Phone_1__c='5555555555';
        insert objcon;
        
        //creating Opportunity
        Opportunity objopp= new Opportunity();
        objopp.AccountId =objAcc.id;
        objopp.Name = 'test';
        objopp.Type='simple';
        objopp.StageName='Universe';
        objopp.CloseDate=system.today();
        //objopp.Product__c = 'test';
        
        //objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
        
        insert objopp;
        
        //creating Event 
        Event objevent = new Event();
        //objevent.AccountId =objAcc.Id;
        objevent.WhatId =objAcc.Id;
        objevent.Subject ='Email';
        objevent.StartDateTime=system.today();
        objevent.EndDateTime=system.today();
        insert objevent; 
        
        //creating Call_Planner
        Call_Planner_2__c objclp = new Call_Planner_2__c();
        objClp.Contact__c =objcon.Name;
        objClp.Call_Objective__c = 'test';
        objClp.Opportunity__c = objopp.id;
        insert objClp;
        ApexPages.StandardController c = new Apexpages.StandardController(objclp);
        CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
        
        objClp.event__c = objevent.id;
        update objClp;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);
        
        objevent.whatid = objClp.id;
        update objevent;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);

        delete objevent;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);
        
        */
        
              }

}
Best Answer chosen by Neal Lightfeldt
PRAKASH JADA 13PRAKASH JADA 13
Okay no problem we'll look into your code
check for my comments that starts with "->" this symbol


/*
*   Crane Barksdale Sandbox 
*   Created : 8-NOV-2012  
*   
*
*/ --> this is perfect
public with sharing class CallPlanner_detailcontroller 
{
 
 /* --> you tried to comment from here. The above is the class and it is having open parenthesis so it needs to have a closed one as well.
    public string mutualpyramid{get;set;}
    public string customer{get;set;}
    public List<Event>lstEvent{get;set;}
    public boolean isEvent{get;set;}
    public final Call_Planner_2__c cplan;

    public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
    {
        
        mutualpyramid = '';
        customer= '';        
        customer = system.label.Customer_Needs; // image Link
        mutualpyramid = system.label.Mutual_Pyramid; // image Link
        isEvent = false;
        lstEvent = new List<Event>();
        
        try
        {
            //Get related events for this Call planner
            integer iCount = [  select count() 
                                from event 
                                where whatid = :ctlr.getId()
                             ];
    
    
    
            if (iCount != 0)
            {
                isEvent = true;
            }
            else 
            {
                this.cplan = (Call_Planner_2__c)ctlr.getRecord();
                if (cplan.event__c == '' || cplan.event__c == null) 
                {
                    isEvent = false;
                } 
                else 
                {
                    lstEvent = [    select id 
                                    from event 
                                    WHERE Id = :cplan.event__c
                                ];
                                
                    if (!lstEvent.isEmpty()) 
                    {
                        isEvent = true;
                    } 
                    else 
                    {
                        isEvent = false;
                    }
                }
            }
        }
        catch(Exception ex)
        {
            System.Debug(ex);
        }
    }

*/
--> Here you have multi-line comment so the system will think that you are trying to close up to here.so what you need to do is like add the closing */ multi-line comment 
/**************************
Test Method
**************************/
--> Again from here you need to start commenting so it will be 
/*
static testMethod void myUnitTest1() {
        
        
        
        //creating Account
        Account objAcc = new Account();
        objAcc.Name='test';
        
        //objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
        //objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
        insert objAcc;
        
        //Creating Contact
        Contact objcon= new Contact();
        objcon.AccountId = objAcc.id;
        objcon.LastName='test';
        objcon.FirstName='test';
        //objcon.Business_Phone_1__c='5555555555';
        insert objcon;
        
        //creating Opportunity
        Opportunity objopp= new Opportunity();
        objopp.AccountId =objAcc.id;
        objopp.Name = 'test';
        objopp.Type='simple';
        objopp.StageName='Universe';
        objopp.CloseDate=system.today();
        //objopp.Product__c = 'test';
        
        //objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
        
        insert objopp;
        
        //creating Event 
        Event objevent = new Event();
        //objevent.AccountId =objAcc.Id;
        objevent.WhatId =objAcc.Id;
        objevent.Subject ='Email';
        objevent.StartDateTime=system.today();
        objevent.EndDateTime=system.today();
        insert objevent; 
        
        //creating Call_Planner
        Call_Planner_2__c objclp = new Call_Planner_2__c();
        objClp.Contact__c =objcon.Name;
        objClp.Call_Objective__c = 'test';
        objClp.Opportunity__c = objopp.id;
        insert objClp;
        ApexPages.StandardController c = new Apexpages.StandardController(objclp);
        CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
        
        objClp.event__c = objevent.id;
        update objClp;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);
        
        objevent.whatid = objClp.id;
        update objevent;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);

        delete objevent;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);
        
     
        
              } --> This one belongs to the method so we need to comment on this as well you need to change the line 140 comment ending statement to below of this line.
  */
}

now save your class. That would resolve your issue.

All Answers

PRAKASH JADA 13PRAKASH JADA 13

Try this

/*
*   Crane Barksdale Sandbox 
*   Created : 8-NOV-2012  
*   
*
*/
public with sharing class CallPlanner_detailcontroller 
{
 
 /*
    public string mutualpyramid{get;set;}
    public string customer{get;set;}
    public List<Event>lstEvent{get;set;}
    public boolean isEvent{get;set;}
    public final Call_Planner_2__c cplan;

    public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
    {
        
        mutualpyramid = '';
        customer= '';        
        customer = system.label.Customer_Needs; // image Link
        mutualpyramid = system.label.Mutual_Pyramid; // image Link
        isEvent = false;
        lstEvent = new List<Event>();
        
        try
        {
            //Get related events for this Call planner
            integer iCount = [  select count() 
                                from event 
                                where whatid = :ctlr.getId()
                             ];
    
    
    
            if (iCount != 0)
            {
                isEvent = true;
            }
            else 
            {
                this.cplan = (Call_Planner_2__c)ctlr.getRecord();
                if (cplan.event__c == '' || cplan.event__c == null) 
                {
                    isEvent = false;
                } 
                else 
                {
                    lstEvent = [    select id 
                                    from event 
                                    WHERE Id = :cplan.event__c
                                ];
                                
                    if (!lstEvent.isEmpty()) 
                    {
                        isEvent = true;
                    } 
                    else 
                    {
                        isEvent = false;
                    }
                }
            }
        }
        catch(Exception ex)
        {
            System.Debug(ex);
        }
    }
*/
    
/**************************
Test Method
**************************/

    /*
static testMethod void myUnitTest1() {
        
        
        
        //creating Account
        Account objAcc = new Account();
        objAcc.Name='test';
        
        //objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
        //objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
        insert objAcc;
        
        //Creating Contact
        Contact objcon= new Contact();
        objcon.AccountId = objAcc.id;
        objcon.LastName='test';
        objcon.FirstName='test';
        //objcon.Business_Phone_1__c='5555555555';
        insert objcon;
        
        //creating Opportunity
        Opportunity objopp= new Opportunity();
        objopp.AccountId =objAcc.id;
        objopp.Name = 'test';
        objopp.Type='simple';
        objopp.StageName='Universe';
        objopp.CloseDate=system.today();
        //objopp.Product__c = 'test';
        
        //objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
        
        insert objopp;
        
        //creating Event 
        Event objevent = new Event();
        //objevent.AccountId =objAcc.Id;
        objevent.WhatId =objAcc.Id;
        objevent.Subject ='Email';
        objevent.StartDateTime=system.today();
        objevent.EndDateTime=system.today();
        insert objevent; 
        
        //creating Call_Planner
        Call_Planner_2__c objclp = new Call_Planner_2__c();
        objClp.Contact__c =objcon.Name;
        objClp.Call_Objective__c = 'test';
        objClp.Opportunity__c = objopp.id;
        insert objClp;
        ApexPages.StandardController c = new Apexpages.StandardController(objclp);
        CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
        
        objClp.event__c = objevent.id;
        update objClp;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);
        
        objevent.whatid = objClp.id;
        update objevent;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);

        delete objevent;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);
        
     
        
              }
   */
}

Explanation: If you open the class then it is not properly commented. If you are using trying to use multi-line comments then you need brake it where there is a multi-line comment already and you need to comment again.

Line 142 closing parenthesis is related to the method. and it is not closed. 
 I hope this helps.

Christan G 4Christan G 4
Hi Neal, I noticed that you have an extra bracket at the end of your code. I believe if you delete one, it will resolve the issue that you are having.
Neal LightfeldtNeal Lightfeldt
Thanks Christan, I tried that but it is referencing an opening bracket at line 78 "Test Method"
Neal LightfeldtNeal Lightfeldt
Thanks Prakash, but I'm not clear on what you're saying. I did try removing the comment at the top of the page but it made no difference. 
Christan G 4Christan G 4
Thank Neal for the quick response. Unfortuantely, I can not see the code # but I think I know which one you are referring to. Why not replace the asterisks around "Test Method" with:
/////////////////////////////////////
//Test Method
/////////////////////////////////////
PRAKASH JADA 13PRAKASH JADA 13
Okay no problem we'll look into your code
check for my comments that starts with "->" this symbol


/*
*   Crane Barksdale Sandbox 
*   Created : 8-NOV-2012  
*   
*
*/ --> this is perfect
public with sharing class CallPlanner_detailcontroller 
{
 
 /* --> you tried to comment from here. The above is the class and it is having open parenthesis so it needs to have a closed one as well.
    public string mutualpyramid{get;set;}
    public string customer{get;set;}
    public List<Event>lstEvent{get;set;}
    public boolean isEvent{get;set;}
    public final Call_Planner_2__c cplan;

    public CallPlanner_detailcontroller(ApexPages.StandardController ctlr)
    {
        
        mutualpyramid = '';
        customer= '';        
        customer = system.label.Customer_Needs; // image Link
        mutualpyramid = system.label.Mutual_Pyramid; // image Link
        isEvent = false;
        lstEvent = new List<Event>();
        
        try
        {
            //Get related events for this Call planner
            integer iCount = [  select count() 
                                from event 
                                where whatid = :ctlr.getId()
                             ];
    
    
    
            if (iCount != 0)
            {
                isEvent = true;
            }
            else 
            {
                this.cplan = (Call_Planner_2__c)ctlr.getRecord();
                if (cplan.event__c == '' || cplan.event__c == null) 
                {
                    isEvent = false;
                } 
                else 
                {
                    lstEvent = [    select id 
                                    from event 
                                    WHERE Id = :cplan.event__c
                                ];
                                
                    if (!lstEvent.isEmpty()) 
                    {
                        isEvent = true;
                    } 
                    else 
                    {
                        isEvent = false;
                    }
                }
            }
        }
        catch(Exception ex)
        {
            System.Debug(ex);
        }
    }

*/
--> Here you have multi-line comment so the system will think that you are trying to close up to here.so what you need to do is like add the closing */ multi-line comment 
/**************************
Test Method
**************************/
--> Again from here you need to start commenting so it will be 
/*
static testMethod void myUnitTest1() {
        
        
        
        //creating Account
        Account objAcc = new Account();
        objAcc.Name='test';
        
        //objAcc.Market_Code__c='910-china';//commented for migration on 3rd may
        //objAcc.District__c='413-Nancy Rapp';//commented for migration on 3rd may
        insert objAcc;
        
        //Creating Contact
        Contact objcon= new Contact();
        objcon.AccountId = objAcc.id;
        objcon.LastName='test';
        objcon.FirstName='test';
        //objcon.Business_Phone_1__c='5555555555';
        insert objcon;
        
        //creating Opportunity
        Opportunity objopp= new Opportunity();
        objopp.AccountId =objAcc.id;
        objopp.Name = 'test';
        objopp.Type='simple';
        objopp.StageName='Universe';
        objopp.CloseDate=system.today();
        //objopp.Product__c = 'test';
        
        //objopp.Price_Target__c=578; //commented for migration frm sand to sand on 3rd may
        
        insert objopp;
        
        //creating Event 
        Event objevent = new Event();
        //objevent.AccountId =objAcc.Id;
        objevent.WhatId =objAcc.Id;
        objevent.Subject ='Email';
        objevent.StartDateTime=system.today();
        objevent.EndDateTime=system.today();
        insert objevent; 
        
        //creating Call_Planner
        Call_Planner_2__c objclp = new Call_Planner_2__c();
        objClp.Contact__c =objcon.Name;
        objClp.Call_Objective__c = 'test';
        objClp.Opportunity__c = objopp.id;
        insert objClp;
        ApexPages.StandardController c = new Apexpages.StandardController(objclp);
        CallPlanner_detailcontroller objdetail = new CallPlanner_detailcontroller(c);
        
        objClp.event__c = objevent.id;
        update objClp;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);
        
        objevent.whatid = objClp.id;
        update objevent;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);

        delete objevent;
        c = new Apexpages.StandardController(objclp);
        objdetail = new CallPlanner_detailcontroller(c);
        
     
        
              } --> This one belongs to the method so we need to comment on this as well you need to change the line 140 comment ending statement to below of this line.
  */
}

now save your class. That would resolve your issue.
This was selected as the best answer
Neal LightfeldtNeal Lightfeldt
Prakash, I understand now and it worked. Thanks very much. 
PRAKASH JADA 13PRAKASH JADA 13
Hi 
Can you please close the case. 

Thanks.
Neal LightfeldtNeal Lightfeldt
I assume you mean selecting a best answer. Sorry, thought I had done that. 
PRAKASH JADA 13PRAKASH JADA 13
Thanks.