Bug 116857 - Not hidden enough API - Hashmap
Not hidden enough API - Hashmap
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Refactoring
6.x
All All
: P3 (vote)
: 6.x
Assigned To: Jan Becicka
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-26 17:05 UTC by Jaroslav Tulach
Modified: 2008-03-03 18:59 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Proposed solution (4.46 KB, text/plain)
2007-10-02 13:46 UTC, Jan Becicka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2007-09-26 17:05:05 UTC
We have just talked with Jan about his attempt to make hidden, yet flexible API in the refactoring module by putting a 
Hashtable into Lookup. He said that his goal was to make "hidden API not visible to others". Well, Hashtable is not 
the best way to solve this. As it is a public interface in java, anyone can just to lookup.lookup(Map.class) and get 
it, read and manipulate its keys.

The proper "hidden" API should be created by defining a private type and having getters and setters on it (or in the 
simplest case just one getter):

public interface PrivateAPIInNonPublicPackage {
  public Hashtable getData();
}

this prevents other modules from easily misusing the hashtable, as they would need a reflection to obtain it. I would 
suggest this or similar change to be made, the hashtable is too visible to be called "hidden", imho.
Comment 1 Jan Becicka 2007-10-01 15:05:42 UTC
Will try to fix for 6.0
Comment 2 Jan Becicka 2007-10-02 13:46:30 UTC
Created attachment 49981 [details]
Proposed solution
Comment 3 Jan Becicka 2007-10-02 13:49:49 UTC
I propose to replace HashMap in favor of brand new API class ExplorerContext (attached).

If there are no objections, I will implement this change by Friday. Sonali, please speak up, if you have any problems
with this solution.
Comment 4 Sonali Kochar 2007-10-02 16:26:41 UTC
I am ok with the change
Comment 5 Jan Becicka 2007-10-04 09:18:05 UTC
reassigning back
Comment 6 Jan Becicka 2007-10-04 09:24:39 UTC
Checking in api/nbproject/project.properties;
/cvs/refactoring/api/nbproject/project.properties,v  <--  project.properties
new revision: 1.5; previous revision: 1.4
done
RCS file: /cvs/refactoring/api/src/org/netbeans/modules/refactoring/api/ui/ExplorerContext.java,v
done
Checking in api/src/org/netbeans/modules/refactoring/api/ui/ExplorerContext.java;
/cvs/refactoring/api/src/org/netbeans/modules/refactoring/api/ui/ExplorerContext.java,v  <--  ExplorerContext.java
initial revision: 1.1
done
Checking in api/src/org/netbeans/modules/refactoring/impl/FolderRenameHandlerImpl.java;
/cvs/refactoring/api/src/org/netbeans/modules/refactoring/impl/FolderRenameHandlerImpl.java,v  <-- 
FolderRenameHandlerImpl.java
new revision: 1.3; previous revision: 1.2
done
Checking in api/src/org/netbeans/modules/refactoring/impl/ClipboardConvertor.java;
/cvs/refactoring/api/src/org/netbeans/modules/refactoring/impl/ClipboardConvertor.java,v  <--  ClipboardConvertor.java
new revision: 1.11; previous revision: 1.10
done
RCS file: /cvs/refactoring/api/apichanges.xml,v
done
Checking in api/apichanges.xml;
/cvs/refactoring/api/apichanges.xml,v  <--  apichanges.xml
initial revision: 1.1
done
Checking in api/manifest.mf;
/cvs/refactoring/api/manifest.mf,v  <--  manifest.mf
new revision: 1.5; previous revision: 1.4
done
Checking in java/src/org/netbeans/modules/refactoring/java/ui/JavaRefactoringActionsProvider.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/ui/JavaRefactoringActionsProvider.java,v  <-- 
JavaRefactoringActionsProvider.java
new revision: 1.20; previous revision: 1.19
done
Checking in java/src/org/netbeans/modules/refactoring/java/ui/RefactoringActionsProvider.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/ui/RefactoringActionsProvider.java,v  <-- 
RefactoringActionsProvider.java
new revision: 1.49; previous revision: 1.48
done
Checking in java/src/org/netbeans/modules/refactoring/java/RenameHandlerImpl.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/RenameHandlerImpl.java,v  <--  RenameHandlerImpl.java
new revision: 1.3; previous revision: 1.2
done
Checking in java/src/org/netbeans/modules/refactoring/java/PackageRenameHandlerImpl.java;
/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/PackageRenameHandlerImpl.java,v  <-- 
PackageRenameHandlerImpl.java
new revision: 1.5; previous revision: 1.4
done
Checking in api/src/org/netbeans/modules/refactoring/spi/impl/SafeDeleteAction.java;
/cvs/refactoring/api/src/org/netbeans/modules/refactoring/spi/impl/SafeDeleteAction.java,v  <--  SafeDeleteAction.java
new revision: 1.8; previous revision: 1.7
done
Checking in api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringGlobalAction.java;
/cvs/refactoring/api/src/org/netbeans/modules/refactoring/spi/impl/RefactoringGlobalAction.java,v  <-- 
RefactoringGlobalAction.java
new revision: 1.10; previous revision: 1.9
done
Comment 7 _ sandipchitale 2008-03-03 18:50:29 UTC
Hmmm..visualweb is also a client of this API. I must have missed this but I was not aware of this change. I guess I need
to monitor the apichanges more closely.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo