Coder Social home page Coder Social logo

privilegedaccessor's People

Contributors

dependabot[bot] avatar sebastiandietrich avatar

Stargazers

 avatar

privilegedaccessor's Issues

Move code from StrictPA to PrivilegedAccessor

... because PrivilegedAccessor is marked as Deprecated.

Attantion: invokeMethod(final Object instanceOrClass, final String 
methodSignature, final Object... arguments) is not 1:1 delegation, because 
Object... are changed into Object[] in StrictPA.

Original issue reported on code.google.com by [email protected] on 18 Mar 2012 at 3:34

Repackaged 5.0 source with ant build script

description copied from sourceforge:

Hi.

I've repackaged the existing source to use Ant to generate the jar, javadocs 
and distribution versions. The java source files themselves are completely 
unchanged, however they were separated into main and test sub-folders.

The ant build.xml file can also run the junit tests, after pulling down the 
junit library using Ivy.

Please see the attached zip file.

E.

Original issue reported on code.google.com by [email protected] on 18 Feb 2012 at 11:23

Autoboxing not supported with arrays

What steps will reproduce the problem?
1. write a private method than expects an int[]
2. call it with PA.invokeMethod

Should work as expected, throws exception instead


   public void testAutoboxing() throws Exception {
      int[] Ints = new int[] {1, 2, 3};
      PA.invokeMethod(this.child, "setPrivateInts(int[])", Ints);
      assertEquals(Ints, PA.getValue(this.child, "privateInts"));
   }

Original issue reported on code.google.com by [email protected] on 1 Jun 2013 at 3:48

Support exception-expecting testing

Would you please support this case:

public class MyClass {
    // My private method throws a exception
    private int myPrivateMethod(int p) throws MyException {
        throw new MyException();
    }
}

// This test expects MyException
@Test(expected = MyException.class)
public void testMyPrivateMethod() {
    PA.invokeMethod(myInstance, "myPrivateMethod", 0);
}

Original issue reported on code.google.com by [email protected] on 8 Aug 2013 at 3:25

array objects as arguments to methods

description copied from sourceforge:

Hi,
I downloaded PA and have started using it at work, but
found I couldn't pass arrays of any type as arguments
to methods. A small modification to
PrivilegedAccessor.java makes this possible.
It's a little bit hacky (have to instantiate an array
object and call getClass() ) but it works. You can
avoid object instantiation for arrays of primitives,
but didn't bother, it was more code for no extra value.

I created a bunch of tests while I was working this
out, so I thought I might as well attach them as well.
There's probably some duplication with you current
tests, I haven't really checked, but I'll clean them up
later if you're interested in keeping them.
... Actually not, I can only attach one file. I can
send them on later if you like.

I'd also like to add some handling for inner classes,
and have some ideas brewing for extending the API if
you would be interested.

Cheers,
nut

Original issue reported on code.google.com by [email protected] on 18 Feb 2012 at 11:20

Extend API with method chaining

E.g. 
PA.new(insatnce).value("fieldName", value).method("methodName", arguments)

OR

PA.new(instance).field("fieldName").value(value).method("methodName").arguments(
arguments)

OR 

PA.new(instance).f("fieldName").v(value).m("methodName").a(arguments)

Original issue reported on code.google.com by [email protected] on 19 Feb 2012 at 9:01

Support methods with varargs

What steps will reproduce the problem?
1. write a class with a private method with varargs
2. try to call that method from outside of that class using PA
3. you will get an IllegalArgumentException based on a NoSuchMethodException

What is the expected output? What do you see instead?
should run fine and call that method


Testcase in PATest that shows that functionality:
public void testInvokeMethodWithVarargs() throws Exception {
   PA.invokeMethod(this.parent, "setNamesWithVarargs(String...)", "Charly", "Browne");
   assertEquals("Charly", PA.getValue(this.parent, "privateName"));
   assertEquals("Browne", PA.getValue(this.parent, "privateObject"));
}

Original issue reported on code.google.com by [email protected] on 23 Apr 2013 at 9:18

Constructors don't work with autoboxing

What steps will reproduce the problem?
1. private constructor expecting primitives (e.g. int, float)
2. try to call it using primitives or object types
3. does not work since varargs are converted to object types




Original issue reported on code.google.com by [email protected] on 25 Sep 2013 at 4:32

Add getMethodSignaturesWithReturnType method that includes return type in String

getMethodSignatures() returns the method name and arguments.  It would be 
helpful to have a version of this getMethodSignaturesWithReturnType() that also 
includes the return type in the String.

Examples of data returned in the existing method are:
getMethodSignatures()
wait()
wait(long)
registerNatives()
equals(java.lang.Object)

Here are versions of those same methods using the new method
getMethodSignaturesWithReturnType()
void wait()
void wait(long)
void registerNatives()
boolean equals(java.lang.Object)

Attached is an implementation of this new method in PrivilegedAccessor and PA 
as well as their associated test classes.  The code is based on the trunk 
version of these files.


Original issue reported on code.google.com by [email protected] on 29 May 2014 at 3:33

Attachments:

names of fields and methodes of an unknown object

copied from old sourceforge location:

The PA could access Fields and invoke methodes only if
the names are KNOWN. 
For this the PA should contain methods to get this names.

I would suggest to implement new features like :
List getFieldNames(Object obj)
List getMethodNames(Object obj)

and for further Information methods like this:
getInformation(<fieldOrMethodname>)
which creates an output like this:

private long <fieldOrMethodname> = 33
protected java.lang.String uppercase(java.lang.String
string)

Perhaps a "scanObject" Method could be useful, which
shows all Fields and methods from the Object like this:

this.is.my.package.structure.Person:
Fields:
private java.lang.String name = "this is the name"
private int age = 33
...
Methods:
public java.lang.String getName()
protected java.lang.String
uppercase(java.lang.String string)
...

best regards,
Matthias Herp

Original issue reported on code.google.com by [email protected] on 18 Feb 2012 at 11:16

provide automatic deployment to maven central

automatically deploy snapshots to maven central
semi-automatically deploy releases to maven central

see 
https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage
+Guide


P.S. continuous delivery is IMHO not a good idea for libraries/frameworks

Original issue reported on code.google.com by [email protected] on 19 Feb 2012 at 8:30

Introduce Expando

Groovy like Expand - dynamically defining object structure/behaviour.

PA.newExpando().field("fieldName").value(value)

Original issue reported on code.google.com by [email protected] on 19 Feb 2012 at 9:04

Return dynamic proxies in instantiate

PA.instantiate("java.lang.String").getValue("value"); // returns the private 
final character storage

should be possible by returnig a dynamic proxy to String

but this proxy should behave like the original class, i.e.
PA.instantiate("java.lang.String").hashCode(); should still work

Original issue reported on code.google.com by [email protected] on 19 Apr 2013 at 7:47

Support constructors with arrays

What steps will reproduce the problem?
1. define a private constructor with an array argument
2. try to invoke that constructor using PA
3. you'll get an IllegalArgumentException

What is the expected output? What do you see instead?
Constructor should be called fine without exeption


Unit-Test:
assertEquals(this.child, PA.instantiate(Child.class, new Class[] 
{String[].class}, new String[] {"Charlie", "Browne"}));

Original issue reported on code.google.com by [email protected] on 23 Apr 2013 at 9:44

unexpected exception

description copied from old sourceforge repository:

final java.lang.reflect.Method m = Database.class.getDeclaredMethod(init, 
File.class);
m.setAccessible(true);
m.invoke(Database.class, dir);
//PrivilegedAccessor.invokeMethod(Database.class,"init(final File dir)", dir);
The commented line should have the same effect as the 3 reflect above it. 
However, that's no the case. Why?
The code is on:

http://memorizeasy.googlecode.com/svn-history/r94/trunk/MemorizEasy/src/com/mysi
mpatico/memorizeasy/test/DatabaseTest.java
http://memorizeasy.googlecode.com/svn-history/r94/trunk/MemorizEasy/src/com/mysi
mpatico/memorizeasy/engine/Database.java

Original issue reported on code.google.com by [email protected] on 18 Feb 2012 at 11:13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.