Recompile with -Xlint:unchecked for detail error in java
When you compile the code use this:
javac -Xlint:unchecked
Then you will see:
MyStack.java:6: warning: [unchecked] unchecked cast
this.s = (T[])new Object[30];
^
required: T[]
found: Object[]
where T is a type-variable:
T extends Object declared in class MyStack\
MyStack.java:11: warning: [unchecked] unchecked cast
T[] b = (T[])new Object[size*2];
^
required: T[]
found: Object[]
where T is a type-variable:
T extends Object declared in class MyStack
2 warnings
So bottom line, the problem is due to the creation of the generic type array. To solve this read this link: https://stackoverflow.com/a/530289/588532
How to recompile with -Xlint:deprecation
To answer my own question, you need to add the following to your project-level build.gradle
file:
allprojects {
...
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
}
How do I compile with -Xlint:unchecked?
Specify it on the command line for javac:
javac -Xlint:unchecked
Or if you are using Ant modify your javac target
<javac ...>
<compilerarg value="-Xlint"/>
</javac>
If you are using Maven, configure this in the maven-compiler-plugin
<compilerArgument>-Xlint:unchecked</compilerArgument>
Activator - how to recompile with -Xlint:unchecked?
Add this to your build.sbt:
javacOptions += "-Xlint:unchecked"
How to recompile a single .cc file in a project built previously with CMake tool in Ubuntu 20.04?
For the time being, I am following this process. I opened two terminal windows, both pointing to the parent directory (i.e ~/Dev/ORB_SLAM3). Everytime I change something in the target file (here it is the ./Examples/Monocular/euroc_mono) I execture the ./build.sh command in one and run the file on the other. I can confirm that though the cmake command looks over all the files, it only builds the one that was changed. I guess this method works when one is using the CMake tool to build a C++ project in Linux.
Related Topics
Looking For C++ Stl-Like Vector Class But Using Stack Storage
How to Detect Unnecessary #Include Files in a Large C++ Project
Why Are String Literals L-Value While All Other Literals Are R-Value
How to Remove/Refactor a «Friend» Dependency Declaration Properly
How to Start a New Cuda Project in Visual Studio 2008
Msvc++ Variadic Macro Expansion
Same Random Numbers Every Loop Iteration
Creating an Input Stream from Constant Memory
Fast Ceiling of an Integer Division in C/C++
What Is a Simple Example of Floating Point/Rounding Error
Object Creation on the Stack/Heap
Scope Vs. Lifetime of Variable
Open Source Pdf Library For C/C++ Application
When Is Uint8_T ≠ Unsigned Char
Efficient String Concatenation in C++