Topic
7 replies Latest Post - ‏2013-03-19T22:36:34Z by Jim Sharpe
Jim Sharpe
Jim Sharpe
98 Posts
ACCEPTED ANSWER

Pinned topic Generated JavaOP references deprecated code?

‏2013-03-14T23:00:05Z |
Using v3.0 fp1 when building the code below this message about using a deprecated API appears in the SPL Build console:

Building main composite: application::foo using build configuration: Distributed

/opt/ibm/InfoSphereStreams/bin/sc -M application::foo --output-directory=output/application.foo/Distributed --data-directory=data --no-toolkit-indexing --no-mixed-mode-preprocessing

Checking constraints...
Creating types...
Creating functions...
Creating operators...
Note: /home/streamsadmin/workspace.cnp_comms/foo/opt/java/src/application/Abstractbar.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Creating PEs...
Creating application model...
Building binaries...

  • SPL Build for project foo completed in 1.858 seconds ----
SPL code follows:

namespace application;

composite foo {
graph
stream<rstring str> Strs = Beacon()
{
param
iterations : 1 ;
period : 0.5 ;
output
Strs : str = "abs" ;
}
stream<rstring x, rstring y> Strs2 = JavaOp(Strs)
{
param
generated : true ;
className : "application.bar" ;
classLibrary : "" ;
}
}

It isn't obvious to me how I can influence the content of the generated Abstractbar.java. Should I be concerned about the warning? Also where can I add the recommended -Xlint option? There doesn't appear to be a place in the build configuration for java compiler options.
  • Jim Sharpe
    Jim Sharpe
    98 Posts
    ACCEPTED ANSWER

    Re: Generated JavaOP references deprecated code?

    ‏2013-03-15T11:30:17Z  in response to Jim Sharpe
    A bit more information.

    It appears why I never noticed this before is that this I had always been using normal java primitive operators and this is the first time I tried the JavaOp with the generating parameter. The former works just fine even when using the source generation helper functions in StreamsStudio. It's only the JavaOp generation that produces the deprecation warning. Also it appears that the pattern of the generated code between the two is a bit different in that JavaOP generated code contains an "extra" abstract class that extends AbstractOperator whereas the normal java primitive directly extends AbstractOperator (at least that's the way it appears when I just went through the cheat sheet again to make sure I wasn't missing something.
    • SystemAdmin
      SystemAdmin
      1245 Posts
      ACCEPTED ANSWER

      Re: Generated JavaOP references deprecated code?

      ‏2013-03-19T19:58:55Z  in response to Jim Sharpe
      Not sure I would recommend using the generated option.

      Java primitives, through their operator model, provide much better integration with SPL, StreamsStudio & metrics, as well as re-use as they are not tied to a single schema. I think some functionality for Java operators will also only work with primitives, in the area of compile time checks and automatic parameter setting.

      There is no way to modify the implicit Java compile that occurs for generated Java operators. The code should not be causing deprecation errors, though.
      • Jim Sharpe
        Jim Sharpe
        98 Posts
        ACCEPTED ANSWER

        Re: Generated JavaOP references deprecated code?

        ‏2013-03-19T20:58:01Z  in response to SystemAdmin
        Yep. I figured the same which is why I had always used the Java primitives over JavaOp. But this time it was such a simple case that I though I'd give JavaOp a shot and that's when I noticed the deprecated warnings. I'm marking this question as answered but someone should probably look into what template might be different between how the StreamsStudio code generation function works as compared to the generation option to JavaOp, since the former compiles clean.
        • SystemAdmin
          SystemAdmin
          1245 Posts
          ACCEPTED ANSWER

          Re: Generated JavaOP references deprecated code?

          ‏2013-03-19T21:00:44Z  in response to Jim Sharpe
          Can you expand on what you mean by the Streams Studio code generation function?
          • Jim Sharpe
            Jim Sharpe
            98 Posts
            ACCEPTED ANSWER

            Re: Generated JavaOP references deprecated code?

            ‏2013-03-19T21:44:47Z  in response to SystemAdmin
            Sure. In a Java class that extends AbstractOperator if you right click and select Source->Override/Implement methods then select "process(StreaminInput<Tuple>)" you get code that looks something like:

            super.process(stream, tuple);

            OutputTuple outTuple = getOutput(0).newTuple();
            outTuple.assign(tuple);

            getOutput(0).submit(out);
            • SystemAdmin
              SystemAdmin
              1245 Posts
              ACCEPTED ANSWER

              Re: Generated JavaOP references deprecated code?

              ‏2013-03-19T22:08:40Z  in response to Jim Sharpe
              Ok - thanks, that's just standard Eclipse Java IDE functionality, not Streams Studio.

              The reason for the difference is that in the generated case an additional abstract operator class is created that contains generated code specific to the operator invocation and its port schemas. My guess is that the generated code is using the old deprecated trace api Logger (deprecated in Streams 3.0 and replaced by Apache log4j and Java platform logging). We will investigate the reason for the deprecated warning.
              • Jim Sharpe
                Jim Sharpe
                98 Posts
                ACCEPTED ANSWER

                Re: Generated JavaOP references deprecated code?

                ‏2013-03-19T22:36:34Z  in response to SystemAdmin
                That makes sense. The reason I had assumed it was something special to Streams, as opposed to being generic eclipse, was that it generated references to things incorporating the words "stream" and "Tuple". But now I see that those were just automatically generated off the names of the input arguments.