0

I am working on an application that hosts user defined stored procedures that are provided as Java class files. The procedures need to be deterministic, and I want to black list various packages and methods that are sources of non-determinism. I have looked at what is available in java.lang.Class and javax.tools.*.

It looks like I can audit members, method parameters, and return types using java.lang.Class. However to audit the method contents it looks like I would have to analyze the raw class file.

There also corner cases like static intitialization blocks and member variable intialization that I need to audit. There are cases like java.util.Date where the default constructor is non-deterministic, but the others are fine.

Is there a framework or tool that would make analyzing these aspects of a class file easy?

aweisberg
  • 131
  • 3

1 Answers1

1

Yest there is. As you say to 'analyze these aspects' use e.g. AspectJ ;) You can use load-time weaving with javaagent for example. Another way is to load users' classes with aspectj classloader. You can declare poincuts looking for given method invocations. You can also enclose users method and count execution time and so on.

zacheusz
  • 8,750
  • 3
  • 36
  • 60