This is quite obviously not a Japanese castle. It's the ruins of Nakijin Castle on the main island of Okinawa, and one of the 5 castle that are part of the World Heritage Gusuku Sites. It's the second largest of the castles at more than 14 acres and with over 1.5 kilometers of wall.
The walls are made of limestone, and very little of it has been worked. The walls are curved and follow the contours of the land, whereas Japanese castle walls are usually straight.
It dates back to the 13th Century, several hundred years before the kind of castles we now think of as Japanese castles were built.
When the Satsuma from Japan invaded in 1609 the castle burnt down and was completely abandoned not long after, although sacred sites within the walls were still visited.
Of the 5 castle sites it is the only one not surrounded by an urban area and there are great views from it.