With Java8 the javadoc checks became stricter. The common solution is to disable the strict javadoc checking. Nevertheless, I started trying to fix the errors in some projects.
But there is one error I don't get fixed.
The corresponding class:
package foo;
import com.google.gwt.user.client.ui.TextArea;
[...]
public class MyClass {
[...]
/**
* #see TextArea#getValue()
*/
public String getValue() {
[...]
}
/**
* #see TextArea#setValue(String value)
*/
public void setValue(String value) {
[...]
}
/**
* #see TextArea#setValue(String, boolean)
*/
public void setValue(String value, boolean fireEvents) {
[...]
}
}
And the error message:
[ERROR] ...\MyClass.java:44: error: reference not found
[ERROR] * #see TextArea#setValue(String value)
[ERROR] ^
[ERROR] ...\MyClass.java:51: error: reference not found
[ERROR] * #see TextArea#setValue(String, boolean)
The error message states that it cannot find TextArea in the Javadoc of the setValue-Methods - but on the other hand has no problems to find TextArea on the getValue-Method.
As far as I can say, I followed How to specify a name as well as #see reference.
Any clues? Thanks a lot!
Okay, I got the answer now, it's a bit tricky!
TextArea extends ValueBoxBase<String>
TextArea#getValue() has no Parameters, so everything is fine
The Method TextArea#setValue(String value) does not exist in TextArea, it is rather defined in the superclass: ValueBoxBase#setValue(Object, boolean).
But there it is! There is "technically" no method setValue(String). It's rather setValue(Object). There is either no way for javadoc to resolve this on its own or it's just a bug.
Thus, the only was I found to solve this is using the reference to the superclass.
/**
* #see com.google.gwt.user.client.ui.ValueBoxBase#setValue(Object, boolean)
*/
Instead of:
/**
* #see TextArea#getValue()
*/
Try:
/**
* #see com.google.gwt.user.client.ui.TextArea#getValue()
*/
I had the sameproblem.
But I solved without () of method.
#see ClassTest.method
Related
I'm having a difficulty understanding how to configure the following.
Since spring-kafka:2.8.4 thee KafkaListener interface can be configured with a filter which will be applied to all incoming messages, the Javadoc for the filter method:
/**
* Set an {#link org.springframework.kafka.listener.adapter.RecordFilterStrategy} bean
* name to override the strategy configured on the container factory. If a SpEL
* expression is provided ({#code #{...}}), the expression can either evaluate to a
* {#link org.springframework.kafka.listener.adapter.RecordFilterStrategy} instance or
* a bean name.
* #return the error handler.
* #since 2.8.4
*/
String filter() default "";
RecordFilterStrategy has a single method:
/**
* Return true if the record should be discarded.
* #param consumerRecord the record.
* #return true to discard.
*/
boolean filter(ConsumerRecord<K, V> consumerRecord);
Basically I need to create a kind of a lambda, but I don't understand how to reference the consumerRecord variable, this is what I have already tried:
#{#consumerRecord.key().equals(T(com.example.kafkaconsumer.EventType).CREATE.toString())}
It fails with the exception:
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1011E:
Method call: Attempted to call method key() on null context object
This is what I'm trying to implement using SPEL:
#Bean
public RecordFilterStrategy<String, Foo> recordFilterStrategy() {
return rec -> !Objects.equals(rec.key(), EventType.CREATE.toString());
}
See that JavaDocs one more time:
Set an {#link org.springframework.kafka.listener.adapter.RecordFilterStrategy} bean
* name
Since you already have a recordFilterStrategy bean, so that's enough for your to use in that filter() attribute:
filter = "recordFilterStrategy"
No need to fight with a complex SpEL.
I am sorry if for someone the title of my question turns out to be very common, but the truth is that I have been trying for hours to obtain the expected result and I have not succeeded.
It happens, that I am developing a small package for Laravel, and I cannot perform a dependency injection in a method within a command that will contain the package.
Inside the directory structure of my package, I have the ServiceProvider
<?php
namespace Author\Package;
use Author\Package\Commands\BaseCommand;
use Author\Package\Contracts\MyInterface;
use Illuminate\Support\ServiceProvider;
class PackageServiceProvider extends ServiceProvider
{
/**
* The commands to be registered.
*
* #var array
*/
protected $commands = [
\Author\Package\Commands\ExampleCommand::class
];
/**
* Register services.
*
* #return void
*/
public function register()
{
if (! $this->app->configurationIsCached()) {
$this->mergeConfigFrom(__DIR__ . '/../config/package.php', 'package');
}
$this->app->bind(MyInterface::class, BaseCommand::class);
}
/**
* Bootstrap services.
*
* #return void
*/
public function boot()
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__ . '/../config/package.php' => config_path('package.php')
], 'package-config');
$this->configureCommands();
}
}
/**
* Register the package's custom Artisan commands.
*
* #return void
*/
public function configureCommands()
{
$this->commands($this->commands);
}
}
As you can see from the register method, I am creating a binding for when it calls the MyInterface interface, it returns the concrete BaseCommand class
public function register()
{
...
$this->app->bind(MyInterface::class, BaseCommand::class);
}
The structure of the ExampleCommand file is as follows:
<?php
namespace Author\Package\Commands;
use Author\Package\Contracts\MyInterface;
use Illuminate\Console\Command;
class ExampleCommand extends Command
{
/**
* The name and signature of the console command.
*
* #var string
*/
protected $signature = 'my:command';
/**
* The console command description.
*
* #var string
*/
protected $description = 'Command Description';
/**
* Execute the console command.
*
* #return void
*/
public function handle(MyInterface $interface)
{
// TODO
}
}
But when I run the command, I get the following error:
TypeError
Argument 1 passed to Author\Package\Commands\ExampleCommand::handle() must be an instance of Author\Package\Contracts\MyInterface, instance of Author\Package\Commands\BaseCommand given
I wonder why dependency injection is not working, in essence it should inject the concrete BaseCommand class into the handle method of the ExampleCommand class, but it isn't. I would appreciate any help you can give me.
Your BaseCommand must implement the interface that you have typehinted for that handle method. Dependency Injection happens before the method is called, so the container resolved your binding (as it is trying to pass an instance of BaseCommand to the method call, handle) but the binding does not return something that implements that contract so PHP won't allow that to be passed for that argument since it doesn't match the type of the argument in the signature (does not implement the contract).
In short: if you are going to bind a concrete to an abstract, make sure the concrete is actually of the type you are binding it to.
I see ParquetFileReader.readFooter was deprecated in parquet-hadoop-1.11.0.jar. What class or which method should be used instead?
Based on code comments, you should use ParquetFileReader#open(InputFile, ParquetReadOptions).
/**
* Reads the meta data block in the footer of the file
* #param configuration a configuration
* #param file the parquet File
* #return the metadata blocks in the footer
* #throws IOException if an error occurs while reading the file
* #deprecated will be removed in 2.0.0;
* use {#link ParquetFileReader#open(InputFile, ParquetReadOptions)}
*/
#Deprecated
public static final ParquetMetadata readFooter(Configuration configuration, Path file) throws IOException {
I have a wsdl file, when creating classes through wsimport I get an interface. This interface has #WebMethod for sending a MessagePrimaryContent.setAny request:
/**
* Sets the value of the any property.
*
* #param value
* allowed object is
* {#link Element }
* {#link Object }
*
*/
public void setAny(Object value) {
this.any = value;
}
I also have an xsd scheme. Through xjc I form jaxb classes. It is the generated class that I need to pass to the setAny method. As a result of trying to send a request, I get an error:
javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.SAXException2: javax.xml.bind.JAXBException: class ru.absenceofdebt.fts.artefacts.x.root._1_0.AbsenceOfDebtRequest nor any of its super class is known to this context.
javax.xml.bind.JAXBException: class ru.absenceofdebt.fts.artefacts.x.root._1_0.AbsenceOfDebtRequest nor any of its super class is known to this context.
It was necessary to do it urgently. Therefore, I had to add an ObjectFactory generated from xsd to #XmlSeeAlso as a temporary solution when building the project in the interface. But this is wrong. How can I do it correctly?
task editFile {
ext.fileService = "${buildDir}/generated/org/tempuri/ISMEVSERVICE.java"
dependsOn wsimport
dependsOn genJaxb
doLast() {
ant.replaceregexp(
file: fileService,
match: "org.tempuri.ObjectFactory.class",
replace: "ru.absenceofdebt.fts.artefacts.x.root._1_0.ObjectFactory.class, org.tempuri.ObjectFactory.class",
byline: "true"
)
}
}
I have an enum which implements an interface. The method is implemented in its constants with a comment for each method:
public interface MyIF{
int foo1();
}
public enum SomeTypes implements MyIF{
TYPE_ONE {
/**
* this method ...
*
* #return ...
*/
#Override
public int foo1() {...}
}, ...
}
Javadoc ignores the method comment. Everything else is generated fine. Is there a way I can make these comments appear in the generated javadoc ?
Thanks