Identifying Unused public Methods in an Application
Is there any other open source that identifes the unused public methods? I have come across many open source that identifies and removes the unused public methods. But, I need only to identify and report it. If anyone knew about any of the open source package that does it, please let me know.
Hi Epesh,
I have found an Open Source Package named PMD from SourceForge that identifies the Unused Private methods,Unused Formal parameters and Reports them.
So if u know any Open Source Package which identifies the Unused Public Methods and reports them,please let me Know.
thanks & regards
Arun
Similar Messages
-
Lint Tool to detect unused public methods?
I'm looking for a java lint tool that will point out <b>public</b> methods that
are unused within my codebase. All of the tools I've reviewed to date
have only detected unused private methods. Does such a tool exist?
If so, can you point me in the right direction?I don't think such a tool can exist, because the tool wouldn't know whether your writing an API or an end user application.
Also, in any program you might end up with public methods that do nothing, but need to be there to complete an interface implementation.
Presumably, the goal with finding the unused public methods is to remove them and to improve performance somehow. I don't think this is a worthwhile exercise as the compiler does a pretty good job of this optimisation already. -
Identifying non-public methods
Is there any way for an object to idenify its own non-public methods (getMethods() returns only those methods that are declared public)?
getDeclaredMethods() - I believe this might do what you want. It throws a SecurityException, but I'm not sure exactly under what circumstances! Oh, and it doesn't return methods defined on any superclasses.
-
Problem with local class, static private attribute and public method
Hello SDN,
Consider the following situation:
1) I have defined a LOCAL class airplane.
2) This class has a private static attribute "type table of ref to" airplane (array of airplanes)
3) A public method should return the private static table attribute
Problems:
a) The table cannot be given as an EXPORTING parameter in the method because TYPE TABLE OF... is not supported and I get syntax errors. I also cannot define a dictionary table type because it is a local class.
b) The table cannot be given as a TABLES parameter in the method because TABLES is not supported in the OO context.
c) The table cannot be given as an EXPORTING parameter in the method defined as LIKE myStaticAttribute because my method is PUBLIC and my attribute is PRIVATE. ABAP syntax requires that all PUBLIC statements are defined before PRIVATE ones, therefore it cannot find the attribute to reference to with LIKE.
I see only 2 solutions:
a) Never ever use local classes and always use global classes so that I might define a dictionary table type of my class which I can then use in my class.
b) Make the attribute public, but this goes against OO principles, and isn't really an option.
Am I missing anything here, or is this simply overlooked so far?Hello Niels
Since your class is local and, thus, only know to the "surrounding" application is does not really make sense to make it public to any other application.
However, if you require to store instances of your local classes in internal tables simply use the most generic reference type possible, i.e. <b>OBJECT</b>.
The following sample report shows how to do that. Furthermore, I believe it also shows that there are <u><b>no </b></u>serious inconsistency in the ABAP language.
*& Report ZUS_SDN_LOCAL_CLASS
REPORT zus_sdn_local_class.
" NOTE: SWF_UTL_OBJECT_TAB is a table type having reference type OBJECT
* CLASS lcl_airplane DEFINITION
CLASS lcl_airplane DEFINITION.
PUBLIC SECTION.
DATA: md_counter(3) TYPE n.
METHODS: constructor,
get_instances
RETURNING
value(rt_instances) TYPE swf_utl_object_tab.
PRIVATE SECTION.
CLASS-DATA: mt_instances TYPE swf_utl_object_tab.
ENDCLASS. "lcl_airplane DEFINITION
* CLASS lcl_airplane IMPLEMENTATION
CLASS lcl_airplane IMPLEMENTATION.
METHOD constructor.
APPEND me TO mt_instances.
DESCRIBE TABLE mt_instances.
md_counter = syst-tfill.
ENDMETHOD. "constructor
METHOD get_instances.
rt_instances = mt_instances.
ENDMETHOD. "get_instance
ENDCLASS. "lcl_airplane IMPLEMENTATION
DATA:
gt_instances TYPE swf_utl_object_tab,
go_object TYPE REF TO object,
go_airplane TYPE REF TO lcl_airplane.
START-OF-SELECTION.
" Create a few airplane instance
DO 5 TIMES.
CREATE OBJECT go_airplane.
ENDDO.
gt_instances = go_airplane->get_instances( ).
CLEAR: go_airplane.
LOOP AT gt_instances INTO go_object.
go_airplane ?= go_object.
WRITE: / 'Airplane =', go_airplane->md_counter.
ENDLOOP.
END-OF-SELECTION.
Regards
Uwe<u></u> -
Including External LVOOP Public Methods in Executable
Hello,
I have an application which on the top level must 'talk' to several different instruments; a LabJack UE9 (USB) , a Newport Motion Controller (USB-Serial), etc. When I wrote the drivers for these instruments in LV, I used the LVOOP functionality and created individual Classes with public methods for each of the different devices I need to communicate with. Sounds logical to me, anyway.
In my top-level application, I call the public methods (and must include local instances of the LVOOP classes) for those independant instrument-specific classes. In the development mode, everything works peachy. However, when I go to build the application executable (build), I get some weird behavior;
Firstly, with the default setting in 'Additional Exclusions' in the Build Properties of 'Remove as much as possible', I get errors when the builder gets to my independent classes. I get the message:
"An error occurred while building the following file:
C:\Documents and Settings\Wes Ramm\My Documents\Projects\RDT\LabJack\Class\Common Methods\Get DO Line State.vi
The VI became broken after disconnecting type definitions. Open the Build Specification and choose a different option on the Additional Exclusions page."
Ok, it seems that the class object is not linking, but I can get around that by selecting the second option in 'Additional Exclusions' ; 'Remove unreferenced project library members'. BUT, when the build is done, I get a couple of subdirectories with vi's named for all the different class methods for each independent that I am calling. There is no front panel or block diagram for the vis, so it looks like they are correctly 'included' in the build, but it seems cumbersome to include these subdirectories.
I even tried to 'add' the independant classes to the project by 'Add Folder', but got the same behavior.
The classes that I made are not a part of the top level VI, and the top Leve VI is not a member of any of the classes, so this I think is the crux of the matter. However, I am instantiating only the public methods, and the problems only pop up when I try to build the executable.
Am I missing something? Is there a more elegant way to do this? Any advise / tutorials / knowledgebase articles you can point me to?
The tree for the directory structure for my build looks like this (for reference)
\\Application Directory\
Executable
\Config
\ Class One.lvclass (first external class that I am calling in my top-level vi)
\ Method 1
\ Method 2
\ Method 3
\ etc
\ Class Two.lvclass
\Method 1
\Method 2
\Method 3
\ etc
Thanks,
Wes Ramm
Wes Ramm, Cyth UK
CLD, CPLIHello Wes Ramm,
It's better late than never! Hence I'm going to address some of the issues that you've brought up.
1) Which version of LabVIEW are you using? LabVIEW 8.5 has fixed a lot of issues that occured between the Application Builder and LV Classes. If you were using LV 8.2, I would suggest changing to LV 8.5 or at least LV 8.2.1
2) Apart from setting "Do not disconnect type definitions or remove unreferenced members" in the Additional Exclusions page, I would suggest also checking the box against "Enable Debugging" on the Advanced Page.
The following forum post has discussed many of the problems that have come up when building an executable which uses LVOOP classes. Hope this helps. -
Public pages in authenticated application (NTLM)
I've been using a custome authentication method based on the NTLM Authentication method documented in the [white paper|http://www.oracle.com/technology/products/database/application_express/pdf/apex_ntlm_authentication_wp.pdf] for a while now with no problems.
This basically does the following 2 steps:
1) Standard NTLM Auth
2) Check returned user ID exists in a seperate table containing valid users
I've recently been working on an application where the bulk of the application is restricted to users with relevant permissions to edit the data. However there needs to be a public search facility open to anyone.
I was assuming that I'd be able to do this by just setting the authentication of the relevant page to "Page is Public", however this has presented a problem.
When I run the app as a user which passes both steps above (ie. auth succeeds), everything works fine.
However when I run as a user which fails step 2 above (auth fails) the public page loads fine, but whenever anything is posted I get an error like
Expecting p_company or wwv_flow_company cookie to contain security group id of application owner.
Error ERR-7621 Could not determine workspace for application (:) on application accept. Also this problem only rears it's head in IE (tried in 7&8), everything works fine in Firefox.
Also I've created a seperate application with just the public page (and the application set to use the DATABASE auth (i.e. no auth)) and this works fine.
This is fine as a workaround in this one instance, but i suspect there is likely to be call for similar public pages in other applications, and I don't want to have to create seperate apps for these unless I really have to.
Anyone any ideas about what the cause of the problem may be, or even pointers about where to look?Try Page properties, Security tab, Authentication setting. It has values: Page requires authentication (default) / page is public. Havent tried though..
Just tried. it works. i manually changed page address in address line like http://something.lt:7777/pls/htmldb/f?p=103:19:3411287399936455. The user connected is "nobody". Public page is page 19.
Simas
Message was edited by:
SimAkas -
Delegate class to access non-public methods during testing?
In the following video, towards the end, someone asked that FlexUnit assumes functions and methods are to be public when tested.
http://tv.adobe.com/watch/max-2008-develop/testing-your-flex-applications-by-michael-labri ola/
The speaker replied (@ 52:25), to use Delegate classes, which are linked in when being tested.
Can someone show me an example of this? Thanks.Mike, thanks for the reply!
As I am new to unit testing, things are still solidifying. I do understand that Unit Testing, “tests the smallest functional unit of code”, which are methods and functions. However, I incorrectly assumed that *every* method needed to be tested *directly*. Hence, I thought all methods would have to be public. So that would have blown encapsulation out of the water. Now I understand from your reply, that private methods get tested indirectly from public methods. And that seems more ideal.
Thanks again. -
Starting Public Worflows Within An Application
The documentation for starting a public workflow within an application is ambiguous.
At the following location: http://e-docs.bea.com/wlintegration/v2_0/collaborate/workflow/start.htm#1331638
you state that a workflow instance is retrieved using the startWorkflow method.
Unfortunately, this is a custom method that must be written and there is no suggested
implementation.
In terms of creating a workflow instance:
For the WorkflowInstance class, there is only one documented constructor (although,
there are 2 constructors). This constructor indicates that a Hashtable Array of
Party properties is a parameter. The documentation doesn't tell us specifically
what goes in these Hashtables, though. And as for the second constructor, we have
no documentation and there is no mention in the API, but I do know that it takes
3 Strings as its parameters.
How do I start a public workflow within an application?
Thanks in advance,
MarkReplace:
WorkflowInstance wi = startWorkflow();
with:
Hashtable[] array = new Hashtable[2];
Hashtable party1 = new Hashtable();
Hashtable party2 = new Hashtable();
party1.put(WorkflowInstance.PARTYNAME_KEY, PARTY_SOURCE);
party2.put(WorkflowInstance.PARTYNAME_KEY, PARTY_DEST);
array[0] = party1;
array[1] = party2;
WorkflowInstance wi = new WorkflowInstance(BUSINESS_PROCESS_NAME,
BUSINESS_PROCESS_MAJOR,
BUSINESS_PROCESS_MINOR,
BUSINESS_PROCESS_ROLE,
array);
"Mark Finlan" <[email protected]> wrote in message
news:3b686b0f$[email protected]..
>
The documentation for starting a public workflow within an application isambiguous.
At the following location:http://e-docs.bea.com/wlintegration/v2_0/collaborate/workflow/start.htm#1331
638
you state that a workflow instance is retrieved using the startWorkflowmethod.
Unfortunately, this is a custom method that must be written and there isno suggested
implementation.
In terms of creating a workflow instance:
For the WorkflowInstance class, there is only one documented constructor(although,
there are 2 constructors). This constructor indicates that a HashtableArray of
Party properties is a parameter. The documentation doesn't tell usspecifically
what goes in these Hashtables, though. And as for the second constructor,we have
no documentation and there is no mention in the API, but I do know that ittakes
3 Strings as its parameters.
How do I start a public workflow within an application?
Thanks in advance,
Mark -
Question on "How-to invoke a method once upon application start"
Hello everyone.
I'm trying to implement what the article "How-to invoke a method once upon application start" by Frank suggests.
https://blogs.oracle.com/jdevotnharvest/entry/how_to_invoke_a_method
Suppose that I'm having a single point of entry, so in my login.jpsx I have the below:
<f:view beforePhase="#{login.onBeforePhase}">In the method "onBeforePhase" I have to pass the phaseEvent, since the signature is the following:
public void onBeforePhase(PhaseEvent phaseEvent)but how do I know the phaseEvent when calling the login.onBeforePhase? How the call should be?
Thanks a lot!
ps. I'm using jDev 11.1.2.1.0You need not pass anything to this method , this method will get called before every Phase except ReStore View
Just write the logic as Frank suggested for the phase in which you want the code to execute. You can get the PhaseId's like
PhaseId.RENDER_RESPONSE
public void onBeforePhase(PhaseEvent phaseEvent) {// from Frank's doc
//render response is called on an initial page request
if(phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE){
... etc -
[svn] 920: Add missing or incomplete Javadoc for public methods.
Revision: 920
Author: [email protected]
Date: 2008-03-25 15:37:25 -0700 (Tue, 25 Mar 2008)
Log Message:
Add missing or incomplete Javadoc for public methods.
(merge from 3.0.x branch)
Modified Paths:
blazeds/trunk/modules/core/src/java/flex/messaging/io/AbstractProxy.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/BeanProxy.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/DictionaryProxy.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/MapProxy.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/PropertyProxy.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/PropertyProxyRegistry.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/SerializationProxy.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/ThrowableProxy.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/AbstractAmfInput.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/AbstractAmfOutput.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/ActionContext.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/AmfTrace.java
blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/translator/ASTranslator.java
blazeds/trunk/modules/core/src/java/flex/messaging/log/ServletLogTarget.java
blazeds/trunk/modules/core/src/java15/flex/messaging/io/Java15TypeMarshaller.java
blazeds/trunk/modules/core/src/java15/flex/messaging/io/amf/Java15Amf0Output.java
blazeds/trunk/modules/core/src/java15/flex/messaging/io/amf/Java15Amf3Output.java
blazeds/trunk/modules/core/src/java15/flex/messaging/io/amfx/Java15AmfxMessageSerializer. javaHello Wes Ramm,
It's better late than never! Hence I'm going to address some of the issues that you've brought up.
1) Which version of LabVIEW are you using? LabVIEW 8.5 has fixed a lot of issues that occured between the Application Builder and LV Classes. If you were using LV 8.2, I would suggest changing to LV 8.5 or at least LV 8.2.1
2) Apart from setting "Do not disconnect type definitions or remove unreferenced members" in the Additional Exclusions page, I would suggest also checking the box against "Enable Debugging" on the Advanced Page.
The following forum post has discussed many of the problems that have come up when building an executable which uses LVOOP classes. Hope this helps. -
Error while calling a super class public method in the subclass constructor
Hi ,
I have code like this:
CLASS gacl_applog DEFINITION ABSTRACT.
PUBLIC SECTION.
METHODS:
create_new_a
IMPORTING pf_obj TYPE balobj_d
pf_subobj TYPE balsubobj
pf_extnumber TYPE string
EXPORTING pfx_log_hndl TYPE balloghndl
EXCEPTIONS error
ENDCLASS.
CLASS gacl_applog IMPLEMENTATION.
METHOD create_new_a.
DATA: ls_log TYPE bal_s_log.
Header aufsetzen
MOVE pf_extnumber TO ls_log-extnumber.
ls_log-object = pf_obj.
ls_log-subobject = pf_subobj.
ls_log-aluser = sy-uname.
ls_log-alprog = sy-repid.
ls_log-aldate = sy-datum.
ls_log-altime = sy-uzeit.
ls_log-aldate_del = ls_log-aldate + 1.
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = ls_log
IMPORTING
e_log_handle = pfx_log_hndl
EXCEPTIONS
OTHERS = 1.
IF ( sy-subrc NE 0 ).
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING error.
ENDIF.
ENDMETHOD.
CLASS gcl_applog_temp DEFINITION INHERITING FROM gacl_applog.
PUBLIC SECTION.
DATA: log_hndl TYPE balloghndl READ-ONLY
, t_log_hndl TYPE bal_t_logh READ-ONLY
METHODS: constructor
IMPORTING pf_obj TYPE balobj_d
pf_subobj TYPE balsubobj
pf_extnumber TYPE string
EXCEPTIONS error
, msg_add REDEFINITION
, display REDEFINITION
ENDCLASS.
CLASS gcl_applog_temp IMPLEMENTATION.
METHOD constructor.
CALL METHOD create_new_a
EXPORTING pf_obj = pf_obj
pf_subobj = pf_subobj
pf_extnumber = pf_extnumber
IMPORTING pfx_log_hndl = log_hndl.
IF ( sy-subrc NE 0 ).
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING error.
ENDIF.
ENDMETHOD.
A public method of Super class has been called from the constructor of the sub class. we are getting the syntax error :
' In the constructor method, you can only access instance attributes, instance methods, or "ME" after calling the constructor of the superclass '
Can you please suggest how to change the code with out affecting the functioanlity.
Thank you ,
Lakshmi.Hi,
Call that method by instance of Subclass. OR
SUPER-->method.
Read very useful document
Constructors
Constructors are special methods that cannot be called using CALL METHOD. Instead, they are called automatically by the system to set the starting state of a new object or class. There are two types of constructors - instance constructors and static constructors. Constructors are methods with a predefined name. To use them, you must declare them explicitly in the class.
The instance constructor of a class is the predefined instance method CONSTRUCTOR. You declare it in the public section as follows:
METHODS CONSTRUCTOR
IMPORTING.. [VALUE(]<ii>[)] TYPE type [OPTIONAL]..
EXCEPTIONS.. <ei>.
and implement it in the implementation section like any other method. The system calls the instance constructor once for each instance of the class, directly after the object has been created in the CREATE OBJECT statement. You can pass the input parameters of the instance constructor and handle its exceptions using the EXPORTING and EXCEPTIONS additions in the CREATE OBJECT statement.
The static constructor of a class is the predefined static method CLASS_CONSTRUCTOR. You declare it in the public section as follows:
CLASS-METHODS CLASS_CONSTRUCTOR.
and implement it in the implementation section like any other method. The static constructor has no parameters. The system calls the static constructor once for each class, before the class is accessed for the first time. The static constructor cannot therefore access the components of its own class.
Pls. reward if useful.... -
Error while accessing a public method of applet from javascript.
Hi,
I am getting "Object doesn't support this property or method" error
when accessing a public method of applet from javascript in IE 6 using
document.applets[0].myMethod();
The same is working in IE 7.
Thanks in advance.
Regards,
PhanikanthI don't know why it happens, but this works for me in both versions:
<applet ..... name="MyApplet">
</applet>and in javascript use
document.MyApplet.myMethod() -
Error when calling a Webservice's public method in Forms10g
Hi,
I'm getting the following error when calling a webservice's public method, i'm using Forms10g 10.1.2.3
java.rmi.RemoteException; nested exception is: HTTP transport error javax.xml.soap.SOAPException
java.security.PrivilegedActionException javax.xml.soap.SOAPException
Message send failed javax.net.ssl.SSLException SSL handshake failed X509CertChI have added the Jar containing the client proxy in both Classpaths(system variable and default.env), the jar has been made with jdk 1.4
I also have tested the client proxy from jDeveloper and it's working there, but in Forms i'm getting this error.
I guess my problem might be that i'm calling a webservice that is secured since the url starts with https
what should i do to fix this ??
Regards
CarlosI understand, so i have a doubt, why the webservice works on jDeveloper ??Not just JDeveloper even soapUI and Neatbeans have a way of working without a client certificate installed.
I do not know how they achieve it. I know that they work without a client DC.
Cheers,
PS: See this http://stackoverflow.com/questions/8887434/webservices-ssl-https, it offers a clue.
The java programs run unhindered when one-way authentication is being used. These products ship with a digital certificate that is in the path of most popular CAs.
Corollary, if the Web Server is configured for mutual authentication then you need to install and configure the client certificate in the tools.
Edited by: Prabodh on Dec 5, 2012 8:36 PM -
Calling Public Method in OOP.
Hello All,
How to call a Public method in one using the object of the other class.
The second class doesn't inherit the first class.
Thanx and Regards,
SampathKumar.Got the solution.
-
Accessing a private variable from a public method of the same class
can anyone please tell me how to access a private variable, declared in a private method from a public method of the same class?
here is the code, i'm trying to get the variable int[][][] grids.
public static int[][] generateS(boolean[][] constraints)
private static int[][][] sudokuGrids()
int[][][] grids; // array of arrays!
grids = new int[][][]
{Are you sure that you want to have everything static here? You're possibly throwing away all the object-oriented goodness that java has to offer.
Anyway, it seems to me that you can't get to that variable because it is buried within a method -- think scoping rules. I think that if you want to get at that variable your program design may be under the weather and may benefit from a significant refactoring in an OOP-manner.
If you need more specific help, then ask away, but give us more information please about what you are trying to accomplish here and how you want to do this. Good luck.
Pete
Edited by: petes1234 on Nov 16, 2007 7:51 PM
Maybe you are looking for
-
How to ignore a signal in linux?
hello, i am writing a program in linux. and i dont want my program to be affected from any button combinations such as ctrl-c, ... what functions should i use? Regards
-
Workflow - no. of characters in mail body restricted
Hi, I have created a workflow which sends mails to SAP inbox and also external mails. But the text of the body gets truncated and I am able to enter only 25 characters and in 1 line only. I want to enter text of about 150 characters. How can I do thi
-
Latest Version of Air won't install on my MAC! Help!
I have a Mac book pro running version 10.7.2. I recently purchased Adobe CS5.5 Master Collection and proceeded to uninstal my previous version so that I could install the new one. After downloading the 'demo' version and then trying to install it, I
-
Converted videos have no audio??
I converted my videos to be formatted to my ipod but when I tried to listen to it the music video had no sound or audio at all. When I play the video on itunes it doesn't have any sound either but the unconverted video does have audio?
-
Lion Safari 5.1 back and forward gestures not working.
Is anyone else having problems with some of the gestures in Safari? They work about 20% of the time. The page moves and the elastically snaps back rather than changing to a previous page.